timeout on urllib.urlopen?

jam jam at newimage.com
Mon Apr 26 08:18:42 EDT 1999


On Mon, Apr 26, 1999 at 07:59:50AM -0400, Steffen Ries wrote:
> 
> I used once SIGALRM to force a timeout. Maybe somebody could comment
> on that approach?
> 
> 
> /steffen
> 
[..snipped code..]

greetings,

all well and good (the more ideas the better), except that if something goes
wrong, all you get is that a timeout happened within 120 seconds.. with the
'select' approach, you have a chance to record the specific error that the
socket had.. sometimes the server is down ('connection refused'), sometimes
the web server itself is having problems, sometimes the network is down,
etc.. you can import additional 'errno' symbols and trap them if necessary,
and even specify a timeout to the select call, so you can trap that
seperately as well.

hope that helps.

regards,
J
-- 
|| visit gfd <http://quark.newimage.com:8080/> 
|| psa member #293 <http://www.python.org/> 
|| New Image Systems & Services, Inc. <http://www.newimage.com/>




More information about the Python-list mailing list