catching a from CORBA.UserException inherited exception

Peter Otten __peter__ at web.de
Fri Aug 22 10:37:00 EDT 2003


Birgit Rahm wrote:

> 3. then I want to invoke a method within a try - except statement, where
> the except statement has to catch an exception defined in the file created
> in 1. - without the try - exception statement the call is correct with the
> correct parameter and throws an exception (that ends the debugging) with
> an incorrect parameter
> now I wanted to catch the correct exception, but I can only catch
> CORBA.UserException in the right way
> 
> What have I to do, to catch the derived exception?

Asuming the userdefined exception MyException is defined in myfile:

import myfile

obj = # your initialization code

try:
    obj.methodThatFails()
except myfile.MyException:
   print "something went wrong in an organized manner"

I am doubting if that is what you want, though. Maybe you could post some
code and the traceback?




More information about the Python-list mailing list