Signals and system

T Koster reply-to-group at use.net
Sun Apr 10 06:55:05 EDT 2005


Hi folks,

My python program needs to download a number of files.  Each file comes 
as a list of mirrors of that file.

Currently, I am using system (os.system) to run wget.  The mechanism is 
in a loop, so that it will try all the mirrors while wget is exiting 
with a non-zero exit status.  This is working fine as long as the user 
feels there is no need to interrupt it.

If wget receives a SIGINT, it stops (as expected) and returns non-zero 
(1 from memory).  The call to system returns the same status code, 
indicating that wget failed, but the program has no knowledge that it 
was a signal the killed wget, rather than a failed download, and as such 
it tries the next mirror.  I would like to be notified if wget received 
any signals, so that the user doesn't need to repetitively press Ctrl-C 
for each and every mirror to get the downloading process to stop.

Can someone point me in the right direction?

Thanks in advance,
Koster



More information about the Python-list mailing list