Catching user defined exceptions from foreign modules
Derek Basch
dbasch at yahoo.com
Sun Sep 29 22:22:47 EDT 2002
Hello,
I have defined 2 simple modules, test1 and test2.
test1 calls the run function of test 2 which returns a
user defined TestError function. I then catch the
exception in test1 and perform a print. Heres the
code:
http://www.geocities.com/dbasch/test1.txt
http://www.geocities.com/dbasch/test2.txt
So, this code works fine for me. However, I have 2
much larger modules that have the same code structure
but in these larger modules the test1 refuses to catch
the raised TestError unless I change the except clause
to:
except test2.TestError:
print 'fudge'
I know that TestError has been imported because I can
put a "print TestError" before the except clause in
test1 and I get "test2.TestError". Can anyone tell me
why I am having to put the test2.TestError instead of
just TestError? It confuses me even further that my
small test modules work like I would expect and it
doesn't work on the larger modules.
Thanks for the help,
Derek Basch
__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com
More information about the Python-list
mailing list