On Wed, 19 Mar 2008 14:45:39 -0700, Jim wrote: > Program randomly aborts when looking up url. The program loop thru > 4000+ records looking > up ID via internet and returns html code which is used in subsequent > processing. The code > for looking-up record is below followed by abort details. Can anyone > help with catching the > abort before program aborts or provide code to automatically start > program?
Yes. Wrap the offending code with a try...except loop, something similar to this. try: contents = urllib2.urlopen(url).read() except URLError, e: if e.errno == 10053: # "Software caused connection abort" response = raw_input( "Temporary failure, Skip/Halt/try Again?") response = response.lower().strip() if response in ('h', 'halt'): break elif response in ('a', 'again', 't', 'try', 'try again'): continue elif response in ('', 's', 'skip'): lines -= 1 continue else: print "Unknown response, boo hiss to you!" raise -- Steven -- http://mail.python.org/mailman/listinfo/python-list