Multiple threaded download streams?
Grant Edwards
grante at visi.com
Sat Feb 25 07:58:41 EST 2006
On 2006-02-25, gjzusenet at gmail.com <gjzusenet at gmail.com> wrote:
> Though Python supports threading, I think it is limited to
> python code - as soon as you issue a command that uses an
> external (C?) module, all of your python threads hang until
> this command returns. Is that true?
No. Not unless the C modules is broken.
> I'm using urllib2 to download many files, and I have a double
> problem:
>
> 1. downloading all of them is painfully slow since it's serial
> - one has to finish before the next request gets sent.
Then don't do it that way.
> 2. my GUI becomes non responsive during the downloads - major
> problem!
Use a separate thread for downloading.
> Is there any way to work around that?
Yes. Use threads.
> I want to run multiple download streams, in parallel, and while keeping
> my program responsive.
Then do it that way.
> Are there alternative modules that I can use for that?
And what, exactly, didn't work right when you tried the
threading module?
--
Grant Edwards grante Yow! I demand IMPUNITY!
at
visi.com
More information about the Python-list
mailing list