justjpm at aol.com
Sat Mar 22 14:38:41 CET 2008
On Mar 20, 7:03 pm, Steven D'Aprano <st... at REMOVE-THIS-
> On Thu, 20 Mar 2008 10:26:14 -0700, Jim wrote:
> > The program is my first and I'm not a programmer so it will take me some
> > time to get your recommendation to work. So far the program runs after I
> > added code based on your example but the program still aborts and none
> > of the code ("Temporary failure, Skip/Halt/try Again?" or "Unknown
> > response, boo hiss to you!") in your example is displayed.
> Try replacing the line:
> exceptURLError, e:
> except urllib2.URLError, e:
> and see if that helps.
Got it to work with your example see code below. The process continued
bypassing the records when exceptions occurred.
My process displayed 'print here 1' then 'print here 4' and continued
process with next record without aborting. What
should be displayed, if anything, with the line "response =
Skip/Halt/try Again?")" as I didn't see anything?
Thanks for your help
except urllib2.URLError, e:
print "here 1"
if e.errno == 10053:
response = raw_input("Temporary failure, Skip/Halt/try
response = response.lower().strip()
if response in ('h', 'halt'):
print "here 2"
elif response in ('a', 'again', 't', 'try', 'try again'):
print "here 3"
elif response in ('', 's', 'skip'):
print "here 4"
lines -= 1
print "Unknown response, boo hiss to you!"
More information about the Python-list