pycat icon indicating copy to clipboard operation
pycat copied to clipboard

Uncatchable Exception in Select Statement

Open abair opened this issue 2 years ago • 0 comments

Even when catching keyboard interrupts, there's an uncaught exception when exiting the program via C^c:

Exception ignored in: <module 'threading' from '/opt/homebrew/Cellar/[email protected]/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/threading.py'>
Traceback (most recent call last):
  File "/opt/homebrew/Cellar/[email protected]/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/threading.py", line 1583, in _shutdown
    lock.acquire()
KeyboardInterrupt:

I believe this is caused by an exception in the generator cleanup. We need to exit the select statement more gracefully in general. This is just a theory because I'm a little out of my depth here.

Here are two StackOverflow articles that may help explain what's happening:

  • https://stackoverflow.com/questions/38036540/what-type-of-message-exception-ignored-in-is
  • https://stackoverflow.com/questions/11949631/why-cant-select-select-catch-closed-socket-error

abair avatar Aug 24 '23 15:08 abair