473,511 Members | 15,581 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

User-defined exception: "global name 'TestRunError' is not defined"

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.

There are a few cases where something goes wrong with the program and
I get this error:

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? Could it be
something like an error happening where it is not explicitly in a try
block, or an error happening while I'm already in an except block, or
something like that?

Thanks,
--JMike
Jul 9 '08 #1
2 3113
jm***@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.

There are a few cases where something goes wrong with the program and
I get this error:

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? Could it be
something like an error happening where it is not explicitly in a try
block, or an error happening while I'm already in an except block, or
something like that?

Thanks,
--JMike
Please post the entire traceback and we might actually be able to help.

The traceback will show a line number where it failed, you can look to see
what is going on at the time.

It is more likely a scoping issue where TestRunError isn't defined in the scope
where the exception is being raised.

-Larry
Jul 9 '08 #2
In article <f6**********************************@e53g2000hsa. googlegroups.com>,
<jm***@alum.mit.eduwrote:
>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
happens:
>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 -- si***@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
Jul 10 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2473
by: Elmar Haneke | last post by:
Hi, I do have an problem with Python and Capisuite. On calling one of the Capisuite functions I get an Exception "global name 'Result' is not defined". Where to search for the problem?...
3
2541
by: Daniel Lidström | last post by:
Hello, I want to have a class that contains only a collection of another class. For example: public __gc class Alignment { public: Alignment(); ... };
4
1998
by: anthony.wolfe | last post by:
Hello all, I'm hoping that someone could help me with this bit of code. I am using reflection to dynamically call a method within an HttpHandler. When a method returns a user defined type that...
1
2907
by: joop23 | last post by:
Hello, I'm getting the following exception. Culture name 'en-securid' is not supported The code is below. What is 'en-securid' and why won't my browser (IE 6) pass in 'en-us?' thx in...
2
4806
by: oopaevah | last post by:
I am using the Microsoft.XMLHTTP object to make server requests ie; ajax. This is working 99% of the time but occasionally it will freeze at the server for 5 minutes and then raise a javascript...
12
3439
by: -Lost | last post by:
What in the world is functionName.name good for? That is: function functionName() { return functionName.name; } I mean, I already had to write out the function's name so it seems that it is...
0
3042
by: =?Utf-8?B?a3Jpc2huYQ==?= | last post by:
Hi i am getting the following error while using XMLSerializer XmlSerializer ser = new XmlSerializer(typeof(Person)); ERROR: Unable to generate a temporary class (result=1). error CS0266: Cannot...
35
3469
by: eliben | last post by:
Python provides a quite good and feature-complete exception handling mechanism for its programmers. This is good. But exceptions, like any complex construct, are difficult to use correctly,...
9
2322
by: asifu9 | last post by:
Hello all, I am new to MS Access VBA, i am using 2007 version. I have a form called feedback, in that load event we calling a method, in that method statement a bug is coming. here is...
0
7245
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7356
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7427
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7085
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7512
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
4741
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3227
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3214
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
785
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.