Gregory Piñero wrote: > How can I catch 2 exceptions at once for example: > > try: > self.gses = opener.open(req) > except (urllib2.HTTPError,urllib2.URLError): > do something.. > > Seems to work, but how do I also get information about the error? > As usual, by adding an additional name after the exception specification:
try: self.gses = opener.open(req) except (urllib2.HTTPError,urllib2.URLError), exdata: do something with exdata ... Pedantically speaking, of course, you aren't catching two exceptions at once because they don't occur simultaneously: you are writing a statement that catches either of two exceptions. regards Steve -- Steve Holden +44 150 684 7255 +1 800 494 3119 Holden Web LLC/Ltd http://www.holdenweb.com Skype: holdenweb http://holdenweb.blogspot.com Recent Ramblings http://del.icio.us/steve.holden -- http://mail.python.org/mailman/listinfo/python-list