socialscan icon indicating copy to clipboard operation
socialscan copied to clipboard

RuntimeError: Event loop is closed

Open iojw opened this issue 4 years ago • 1 comments

When running on Windows with Python 3.8, the following exception is thrown after the results of socialscan are printed.

Exception ignored in: <function _ProactorBasePipeTransport.__del__ at 0x03F71DA8>
Traceback (most recent call last):
  File "c:\users\isaac\appdata\local\programs\python\python38-32\lib\asyncio\proactor_events.py", line 116, in __del__
    self.close()
  File "c:\users\isaac\appdata\local\programs\python\python38-32\lib\asyncio\proactor_events.py", line 108, in close
    self._loop.call_soon(self._call_connection_lost, None)
  File "c:\users\isaac\appdata\local\programs\python\python38-32\lib\asyncio\base_events.py", line 711, in call_soon
    self._check_closed()
  File "c:\users\isaac\appdata\local\programs\python\python38-32\lib\asyncio\base_events.py", line 504, in _check_closed
    raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed

As far as I can tell, this is due to the change whereby Python 3.8 now uses ProactorEventLoop as the default event loop on Windows which causes this exception to be thrown in aiohttp. A fix appears to be scheduled for the next release of aiohttp (https://github.com/aio-libs/aiohttp/issues/4324).

iojw avatar Jan 21 '20 15:01 iojw

To avoid this error from clogging up the output, I've now set the event loop policy explicitly to SelectorEventLoop when this tool is run on Windows on Python 3.8. However, I understand that ProactorEventLoop is still the more performant event loop on Windows so I'll likely switch back to ProactorEventLoop if the upcoming release of aiohttp fixes this error.

iojw avatar Jan 26 '20 01:01 iojw