KeyboardInterrupt ignored on Windows
See original GitHub issueHello, with the sample below after hitting Ctrl+C, the script exits on Linux but nothing happens on Windows.
Linux
python 3.8.6
python-engineio 3.13.2
python-socketio 4.6.0
Windows
python 3.8.5/3.9.0 neither is working
python-engineio 3.13.2
python-socketio 4.6.0
import socketio
sio = socketio.Client(logger=True, engineio_logger=True)
nspc = "/example"
@sio.event(namespace=nspc)
def connect():
print("Connected.")
@sio.event(namespace=nspc)
def disconnect():
print("Disconnected.")
sio.connect("https://example.com", namespaces=[nspc], transports="websocket")
sio.wait()
The connect
event handler gets invoked, the PING/PONG starts and I attempt Ctrl+C with no success on Windows.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:14 (6 by maintainers)
Top Results From Across the Web
Why is KeyboardInterrupt not working in python?
You're running this code in an IDE like PyCharm. The IDE is taking ctrl+c (keyboardinterrupt) as copy. Try running your code in the...
Read more >Issue 21822: [Windows] KeyboardInterrupt during Thread.join ...
Parting thoughts based on my limited expertise in the area, take them or ignore them: * Semaphore-based AllocNonRecursiveMutex (!_ ...
Read more >Complete Guide to Python KeyboardInterrupt - eduCBA
Guide to Python KeyboardInterrupt. Here we discuss how KeyboardInterrupt exception work, how to avoid KeyboardInterrupt exceptions in Python.
Read more >Control-C handling in Python and Trio - Nathaniel J. Smith
Option 1: KeyboardInterrupt ... The first option is to ignore the issue entirely. By default, the Python interpreter sets things up so that ......
Read more >How to Kill a Python Thread - miguelgrinberg.com
At this point the main thread of the application raised the KeyboardInterrupt exception and wanted to exit, but the background thread did ...
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
Example code to handle
Ctrl+c
usingwin32api.SetConsoleCtrlHandler
(installpywin32
first or usectypes
).Hello, i have the same problem
I currently have a NodeJS server, with python as client when i connect to the server i can’t close the connection which make me close the whole terminal and re-open with venv again …