Re: Signals and system



# reply-to-group@xxxxxxx / 2005-04-10 20:55:05 +1000:
> 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?

http://docs.python.org/lib/os-process.html#l2h-1682

"On Unix, the return value is the exit status of the process encoded
in the format specified for wait()."

http://docs.python.org/lib/os-process.html#l2h-1684

"return a tuple containing its pid and exit status indication: a
16-bit number, whose low byte is the signal number that killed the
process, and whose high byte is the exit status (if the signal
number is zero); the high bit of the low byte is set if a core file
was produced"

--
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man. You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991
.



Relevant Pages

  • Signals and system
    ... My python program needs to download a number of files. ... The mechanism is in a loop, so that it will try all the mirrors while wget is exiting with a non-zero exit status. ... 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. ...
    (comp.lang.python)
  • Re: download manager
    ... What exactly does a download manager do that Firefox and wget can't? ... [Axel can do this] ... Search for and use mirrors (there are various file search engines that ...
    (Debian-User)
  • Re: Fedora...1st Impressions
    ... >> mirrors but all I could find was the RPM's. ... Download in Progress .....:-) I couldnt find any on the ...
    (linux.redhat)
  • Wget, curl, Yum :it was [Strange things in Yum]]
    ... failure: repodata/repomd.xml from base: No more mirrors to try. ... Couldn't resolve host 'download.fedora.redhat.com' ... where eth0 is the internal network and eth1 is the external network to ADSL modem ...
    (Fedora)
  • Re: Free Metalworking Plans
    ... NRA LOH & Endowment Member, Golden Eagle, Patriot"s Medal. ... | I Dl'd the lathe plans, ... Use something like Wget ... or some other worthy download manager to retrieve it. ...
    (rec.crafts.metalworking)