472,374 Members | 1,457 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,374 software developers and data experts.

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 3004
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
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
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
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
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
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
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
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
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
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
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
1
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
1
by: Johno34 | last post by:
I have this click event on my form. It speaks to a Datasheet Subform Private Sub Command260_Click() Dim r As DAO.Recordset Set r = Form_frmABCD.Form.RecordsetClone r.MoveFirst Do If...
0
by: jack2019x | last post by:
hello, Is there code or static lib for hook swapchain present? I wanna hook dxgi swapchain present for dx11 and dx9.
0
DizelArs
by: DizelArs | last post by:
Hi all) Faced with a problem, element.click() event doesn't work in Safari browser. Tried various tricks like emulating touch event through a function: let clickEvent = new Event('click', {...

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.