asyncio event loop isn't closed on exit
See original GitHub issueWhen run with Python 3.8.5 on Ubuntu 20.04 LTS, the event loop isn’t closed when the example is quit by pressing q
.
Following error is output and the program exists:
/usr/lib/python3.8/asyncio/base_events:654: ResourceWarning: unclosed event loop <_UnixSelectorEventLoop running=False closed=False debug=False>
The terminal is then printing raw bytes (?) of the mouse movement anytime you move the cursor over the window.
I’m not sure if it’s the Python version or some difference between Linux and OSX.
(In order to run the example I had to patch src/textual/_parser.py
, because the type hint list[str]
isn’t supported in 3.8. I just replaced it with list
.)
Issue Analytics
- State:
- Created 2 years ago
- Comments:5
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 ...
I assume this is yet another strange issue with asyncio's stream.close() - it schedules the closing of the socket but it's not guaranteed...
Read more >Event Loop — Python 3.11.1 documentation
Close the event loop. The loop must not be running when this function is called. Any pending callbacks will be discarded. This method...
Read more >Wait until a stream is closed? - Google Groups
A transport has a close() method but no wait_closed() method. In the UDP echo server example, tranport.close() is called while the event loop...
Read more >RuntimeError: Event loop is closed : r/learnpython - Reddit
import requests, aiohttp, asyncio, re apple = [] link ... How can I fix this RuntimeError: Event loop is closed error? Thank you!!...
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 FreeTop 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
Top GitHub Comments
Yeah, there is an entire shutdown procedure I need to figure out.
Not sure if you know this, but if your terminal gets messed up like this you can enter “reset” command.
That’s fixed in a branch I’m working on.