Thread issue

James Matthews nytrokiss at gmail.com
Wed Aug 29 17:32:44 EDT 2007


Hi

I have a program that downloads webpages. The webpages are stored in a list
and i make each has it's own thread that downloads it. Sometimes the threads
exit (because urlopen() throws an exception) Now the question is how can i
recover from this thread failing


Example Code
from urllib import urlopen
import threading

threaded_object = []
urls= [url1,url2....]
for i in urls:
       do_thread = threading.Thread(target=urlopen,args=(url,))
        threaded_object.append(do_thread)
 for i in threaded_object:
        i.start()
    for i in threaded_object:
        i.join()

Thanks
James



-- 
http://www.goldwatches.com/
http://www.jewelerslounge.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20070829/d4498eba/attachment.html>


More information about the Python-list mailing list