BurnySc2/python-sc2

RuntimeError: This event loop is already running

Closed this issue · 1 comments

I'm using Windows 10; Python was installed via Anaconda full instalation and I use Spyder console. Python version is 3.8.8.
Trying to run the default worker rush bot as in the readme, I'm getting this error.

runfile('C:/Users/Piotr/.spyder-py3/temp.py', wdir='C:/Users/Piotr/.spyder-py3')
Traceback (most recent call last):

  File "C:\Users\Piotr\.spyder-py3\temp.py", line 11, in <module>
    run_game(maps.get("Acropolis LE"), [

  File "C:\Users\Piotr\anaconda3\lib\site-packages\sc2\main.py", line 603, in run_game
    result = asyncio.get_event_loop().run_until_complete(_host_game(map_settings, players, **kwargs))

  File "C:\Users\Piotr\anaconda3\lib\asyncio\base_events.py", line 592, in run_until_complete
    self._check_running()

  File "C:\Users\Piotr\anaconda3\lib\asyncio\base_events.py", line 552, in _check_running
    raise RuntimeError('This event loop is already running')

RuntimeError: This event loop is already running

I had managed to resolve this issue by adding

import nest_asyncio
nest_asyncio.apply()

so I'm going to assume that this might be caused by asyncio internal issue, but as I'm not very well familiar with the Python environment, I've decided to report this just in case it'd be helpful.

Should be fixed in #131 using asyncio.run()