User-defined exception: "global name 'TestRunError' is not defined"
siona at chiark.greenend.org.uk
Thu Jul 10 14:37:37 CEST 2008
In article <f67cfca9-dffe-4931-a206-8d96b441a236 at e53g2000hsa.googlegroups.com>,
<jmike at alum.mit.edu> wrote:
>I'm using some legacy code that has a user-defined exception in it.
>The top level program includes this line
>from TestRunError import *
>It also imports several other modules. These other modules do not
>explicitly import TestRunError. TestRunError is raised in various
>places throughout the modules.
The import line imports TestRunError into the "global" namespeace
of the top level program module *only*. It is not magically
propogated to the other modules imported -- if they want to use
TestRunError themselves, they have to import it, otherwise this
>FATAL ERROR: global name 'TestRunError' is not defined
>I realize this is kind of a silly question to ask in the general sense
>without showing more of the code, but does anyone have any suggestions
>as to the most likely causes of this error coming up?
The cause is whoever wrote the legacy code not understanding
how to program in Python.
\S -- siona at chiark.greenend.org.uk -- http://www.chaos.org.uk/~sion/
"Frankly I have no feelings towards penguins one way or the other"
-- Arthur C. Clarke
her nu becomeþ se bera eadward ofdun hlæddre heafdes bæce bump bump bump
More information about the Python-list