Killing the python interpreter as a user with no chance for the program to catch

Some programs catch CTL-C (permanently), meaning it is impossible to free your command line from the python interpreter.

You should be able to force call (in C) exit(0) by doing something like alt-ctl-c

One can kill a running program with Task Manager (Ctrl-Alt-Del). If running in Command Prompt, one can kill Command Prompt and anything running in it (usually) by clicking on the title bar. (But zombie processes, only killable in TM are not impossible.) Ultimately, one can reboot or even cut the power.

On Unix systems, Ctrl-Backslash will send SIGQUIT. That might help.

1 Like

On UNIX, you can also do

pkill -SIGKILL -f "command argument argument..."

if the process was launched with command argument argument....

Ultimately, this has nothing to do with Python specifically. All programs can catch SIGINT. Therefore it is not Python’s job to provide tools for interrupting programs forcefully.

Windows has Ctrl+Break (where “Break” is the key labeled “Pause”, “Break” or “Brk” on your keyboard. On notebooks it’s often missing.)
Ctrl+Break sends a signal similar to Ctrl+C. Windows allows both types of signals to be caught, but most programs only handle Ctrl+C so Ctrl+Break can be used to forcefully abort them.