[DB-SIG] DCOracle-1.3.0 try/except

Mike Olson Mike.Olson@fourthought.com
Thu, 03 Aug 2000 17:34:15 -0600


"M.-A. Lemburg" wrote:
> 

> 
> Looks like DCOracle still uses strings as error objects - bad
> thing since these are deprecated.
> 
> This should print the definition location of the error
> message, BTW:
> 
> >>> import sys
> >>> try:
> ...     1/0
> ... except:
> ...     print sys.exc_info()
> ...
> (<class exceptions.ZeroDivisionError at 80a6e30>, <exceptions.ZeroDivisionError instance at 80f4fe0>, <traceback object at 80f4f90>)
> >>>
> >>> import exceptions
> >>> exceptions.ZeroDivisionError
> <class exceptions.ZeroDivisionError at 80a6e30>
> 
> sys.exc_info()[0] has the class object you want !

They do use strings, I actually ran into this a bit ago as well.  I had
to put:

except oci.error, e:

to get it to work. 

Mike


> 
> --
> Marc-Andre Lemburg
> ______________________________________________________________________
> Business:                                      http://www.lemburg.com/
> Python Pages:                           http://www.lemburg.com/python/
> 
> _______________________________________________
> DB-SIG maillist  -  DB-SIG@python.org
> http://www.python.org/mailman/listinfo/db-sig

-- 
Mike Olson				 Principal Consultant
mike.olson@fourthought.com               (303)583-9900 x 102
Fourthought, Inc.                         http://Fourthought.com 
Software-engineering, knowledge-management, XML, CORBA, Linux, Python