'RuntimeError: Event loop is closed' when running under Windows
See original GitHub issueWhen running dinghy under windows I’m getting an ‘Event loop is closed’ error from the asyncio lib, even though the output file is created without issues.
The exact same command runs fine under Ubuntu, without exceptions - same repository, github token, dinghy version; error only happens on windows.
- Windows version: Windows 10 20H2 19042.1766, 64b
- Python version: 3.9.1 (64b)
- Dinghy version: 0.12.0
Note: the digest.html file was generated fine, so the exception thrown might be a minor issue related to resource cleanup.
Error log
C:\Users\heckler>python3 -m dinghy https://github.com/heckler/home-assistant-config
Wrote digest: digest.html
Exception ignored in: <function _ProactorBasePipeTransport.__del__ at 0x00000221711D58B0>
Traceback (most recent call last):
File "C:\Users\heckler\AppData\Local\Programs\Python\Python39\lib\asyncio\proactor_events.py", line 116, in __del__
self.close()
File "C:\Users\heckler\AppData\Local\Programs\Python\Python39\lib\asyncio\proactor_events.py", line 108, in close
self._loop.call_soon(self._call_connection_lost, None)
File "C:\Users\heckler\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 746, in call_soon
self._check_closed()
File "C:\Users\heckler\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 510, in _check_closed
raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed
Exception ignored in: <function _ProactorBasePipeTransport.__del__ at 0x00000221711D58B0>
Traceback (most recent call last):
File "C:\Users\heckler\AppData\Local\Programs\Python\Python39\lib\asyncio\proactor_events.py", line 116, in __del__
self.close()
File "C:\Users\heckler\AppData\Local\Programs\Python\Python39\lib\asyncio\proactor_events.py", line 108, in close
self._loop.call_soon(self._call_connection_lost, None)
File "C:\Users\heckler\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 746, in call_soon
self._check_closed()
File "C:\Users\heckler\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 510, in _check_closed
raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed
Issue Analytics
- State:
- Created a year ago
- Comments:13 (5 by maintainers)
Top Results From Across the Web
"Asyncio Event Loop is Closed" when getting loop
As of Python 3.7, the process of creating, managing, then closing the loop (as well as a few other resources) is handled for...
Read more >Python 3.8+ raises "RuntimeError: Event Loop is closed" on ...
aclose finishes, which means the socket is actually deleted upon garbage collection, and by then I suppose the event loop is already closed......
Read more >RuntimeError: Event loop is closed : r/learnpython
Currently learning about async, and it's been a real challenge converting sync -> async. For example, the script below parses URLs from a...
Read more >asyncio runtimeerror event loop is closed
To workaround this, you need to run event loop in forever loop and close manually. Following code will cover both windows and other...
Read more >Event Loop — Python 3.11.1 documentation
Raise a RuntimeError if there is no running event loop. This function can only be called from a coroutine or a callback. New...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
you only need to ignore the runtime error rather than switching over to the SelectorEventLoop:
(more people should use the ProactorEventLoop!)
https://vstinner.github.io/sys-unraisablehook-python38.html