Catching user defined exceptions from foreign modules
Dennis Lee Bieber
wlfraed at ix.netcom.com
Mon Sep 30 01:54:00 EDT 2002
Derek Basch fed this fish to the penguins on Sunday 29 September 2002
07:22 pm:
> 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.
>
I don't even see why "test1" is working. You explicitly import the
exception by name, but you didn't bring in "TryItOut"... That alone
should have raised an exception.
[wulfraed at beastie wulfraed]$ python test1.py
Traceback (most recent call last):
File "test1.py", line 14, in ?
letitrip.run()
File "test1.py", line 7, in run
tryitout = TryItOut()
NameError: global name 'TryItOut' is not defined
--
> ============================================================== <
> wlfraed at ix.netcom.com | Wulfraed Dennis Lee Bieber KD6MOG <
> wulfraed at dm.net | Bestiaria Support Staff <
> ============================================================== <
> Bestiaria Home Page: http://www.beastie.dm.net/ <
> Home Page: http://www.dm.net/~wulfraed/ <
More information about the Python-list
mailing list