Re: How to prevent the script from stopping before it should

2005-01-18 Thread python
Fredrik Lundh wrote: > Steve Holden wrote: > > > You will need to import the socket module and then call socket.setdefaulttimeout() to ensure that > > communication with non-responsive servers results in a socket exception that you can trap. > > or you can use asynchronous sockets, so your program

Re: How to prevent the script from stopping before it should

2005-01-17 Thread python
Steve Holden wrote: > [EMAIL PROTECTED] wrote: > > > #import urllib, sys > > #pages = ['http://www.python.org', 'http://xxx'] > > #for i in pages: > > # try: > > #u = urllib.urlopen(i) > > #print u.geturl() > > #except Exception, e: > > #print >> sys.stderr, '%s: %s'

Re: How to prevent the script from stopping before it should

2005-01-17 Thread Fredrik Lundh
Steve Holden wrote: > You will need to import the socket module and then call > socket.setdefaulttimeout() to ensure that > communication with non-responsive servers results in a socket exception that > you can trap. or you can use asynchronous sockets, so your program can keep processing the

Re: How to prevent the script from stopping before it should

2005-01-17 Thread Steve Holden
[EMAIL PROTECTED] wrote: #import urllib, sys #pages = ['http://www.python.org', 'http://xxx'] #for i in pages: # try: #u = urllib.urlopen(i) #print u.geturl() #except Exception, e: #print >> sys.stderr, '%s: %s' % (e.__class__.__name__, e) will print an error if a page

Re: How to prevent the script from stopping before it should

2005-01-17 Thread [EMAIL PROTECTED]
#import urllib, sys #pages = ['http://www.python.org', 'http://xxx'] #for i in pages: # try: #u = urllib.urlopen(i) #print u.geturl() #except Exception, e: #print >> sys.stderr, '%s: %s' % (e.__class__.__name__, e) will print an error if a page fails opening, rest open

RE: How to prevent the script from stopping before it should

2005-01-17 Thread Batista, Facundo
Title: RE: How to prevent the script from stopping before it should [EMAIL PROTECTED] #- I have a script that downloads some webpages.The problem is that, #- sometimes, after I download few pages the script hangs( stops). What do you mean with "hangs"? It raises an error an