Problem with subprocess.Popen wget within a thread
Sebastian "lunar" Wiesner
basti.wiesner at gmx.net
Sun Jul 6 14:33:42 EDT 2008
Mathieu Prevot <mathieu.prevot at gmail.com>:
> it seems the script (A) finishes before the downloading ends, and the
> (B) version doesn't (wanted behavior) ... this is unexpected. What
> happens ?
"readlines" blocks, until the pipe is closed, which usually happens, if the
process dies.
On the other hand, spawned processes are usually asynchronous, you have to
explicitly _wait_ for them. And you're not waiting for it in example A.
Anyway, the _proper_ way to wait for a child process is ... guess what ...
the "wait" method of the Popen object ;)
--
Freedom is always the freedom of dissenters.
(Rosa Luxemburg)
More information about the Python-list
mailing list