Fully handling exceptions.

Jordan Katz katz at underlevel.net
Sat Aug 18 23:01:35 CEST 2001


  I have the following piece of code:

    import urllib
      src_in = urllib.urlopen(ag_url)
    except IOError:
      print '%s : connection cannot be made or \
             server returned error.' %(ag_url)
      print '%s : unknown error.' %(ag_url)

  urllib's manual documents IOError as the only possible exception
  raised by urlopen; does this make my last except superfluous, or can
  there be other exceptions raised when urlopen is called that the
  last except may handle?

Jordan Katz <katz at underlevel.net>  |  Mind the gap

More information about the Python-list mailing list