killing a script

Thomas Jollans t at jollybox.de
Mon Aug 29 03:49:26 EDT 2011


On 2011-08-29 05:08, Russ P. wrote:
> Yes, but if I am not mistaken, that will require me to put a line or 
> two after each os.system call. That's almost like whack-a-mole at the 
> code level rather than the Control-C level. OK, not a huge deal for 
> one script, but I was hoping for something simpler. I was hoping I 
> could put one line at the top of the script and be done with it.

It's perfectly normal error-handling procedure. In Python, errors are 
usually handled by exceptions, but if you embed a system that doesn't 
support exceptions, e.g. external processes or a C library via ctypes, 
you will of course have to write a little more code in order to handle 
errors correctly.

T



More information about the Python-list mailing list