URLError

Jim justjpm at aol.com
Sat Mar 22 09:38:41 EDT 2008


On Mar 20, 7:03 pm, Steven D'Aprano <st... at REMOVE-THIS-
cybersource.com.au> wrote:
> 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:
>
> with:
>
> except urllib2.URLError, e:
>
> and see if that helps.
>
> --
> Steven

Steven,

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 =
raw_input("Temporary failure,
Skip/Halt/try Again?")" as I didn't see anything?

Thanks for your help
Jim

Code:
        except urllib2.URLError, e:
           print "here 1"
           if e.errno == 10053:
              response = raw_input("Temporary failure, Skip/Halt/try
Again?")
              response = response.lower().strip()
           if response in ('h', 'halt'):
              print "here 2"
              break
           elif response in ('a', 'again', 't', 'try', 'try again'):
              print "here 3"
              continue
           elif response in ('', 's', 'skip'):
              print "here 4"
              lines -= 1
              continue
           else:
              print "Unknown response, boo hiss to you!"
              raise



More information about the Python-list mailing list