Catching user defined exceptions from foreign modules

Dennis Lee Bieber wlfraed at
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
Traceback (most recent call last):
  File "", line 14, in ?
  File "", line 7, in run
    tryitout = TryItOut()
NameError: global name 'TryItOut' is not defined

 > ============================================================== <
 >   wlfraed at  | Wulfraed  Dennis Lee Bieber  KD6MOG <
 >      wulfraed at     |       Bestiaria Support Staff       <
 > ============================================================== <
 >        Bestiaria Home Page:         <
 >            Home Page:             <

More information about the Python-list mailing list