[Tutor] how to stop a running program in python without closing python interface?

Steven D'Aprano steve at pearwood.info
Sun Feb 12 23:19:40 CET 2012


Debashish Saha wrote:
> actually a i ran a progam in python which is sufficiently large . so i
> want to stop the execution of the program now . how can i do this?

Control-C should work on every operating system. Obviously you have send the 
Ctrl-C to the Python process, not some other application. E.g. if you are 
running your program in a terminal window, bring the terminal window to the 
front so it captures keystrokes and type Ctrl-C.

If you have to kill the Python process from outside, use your operating 
system's standard method for killing processes. E.g. on Windows you would type 
ctrl-alt-del and then select which process to kill from the dialog box. On 
Linux you would use the ps and kill commands.


-- 
Steven


More information about the Tutor mailing list