tino at wildenhain.de
Thu Mar 5 18:19:59 CET 2009
> I am currently working on my program which send queries to Yahoo and
> then saves them into a flatfile. The problem I have is that I need to
> conduct 200 searches and Yahoo typically times out during the search
> with an error. I have caught the error and told it to time.sleep(10)
> however I can only think of deleting the flatfile and starting again
> hoping that it will not time out again.
> Is it possible to get the program to catch the exception, wait 10
> seconds, then carry of from where it was rather than starting again?
> If so, could someone please inform me how to do this?
for search in range(200):
for t in range(MAXRETRY):
except IOError,e: # or whaterver error you get
# log something ...
else: # if above runs w/o break
raise XYZError...() # define appropriate for your app
# here you can work with result
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 3241 bytes
Desc: S/MIME Cryptographic Signature
More information about the Python-list