回复: my multi-download program can't finish
守株待兔
1248283536 at qq.com
Thu Sep 8 03:46:55 EDT 2011
sometimes,the output is:
error: [Errno 104] Connection reset by peer
------------------ 原始邮件 ------------------
发件人: "Steven D'Aprano"<steve+comp.lang.python at pearwood.info>;
发送时间: 2011年9月8日(星期四) 中午1:08
收件人: "python-list"<python-list at python.org>;
主题: Re: my multi-download program can't finish
On Thu, 8 Sep 2011 02:24 pm 守株待兔 wrote:
[...]
> try:
> url = jobs.get()
> hx = httplib2.Http()
> resp, content = hx.request(url, headers=headers)
> jobs.task_done()
> except:
> print "wrong" , url
> when it run ,it can download someting ,
> it is strang:there is wrong output ,some web can't get,but the program
> can't stop,it stay ,run ,can't fininsh, i don't know why?
If you read the helpful error messages that Python provides, instead of
hiding them and printing a useless message "wrong", you might find out why
the failures are happening.
Get rid of the try...except and see what exceptions you get. Then you will
be in a better situation to decide which exceptions should be caught, and
which are bugs that need to be fixed, and which should be allowed through.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20110908/97d3446e/attachment.html>
More information about the Python-list
mailing list