
September 22nd, 2012, 04:17 PM
|
|
Registered User
|
|
Join Date: Sep 2012
Posts: 5
Time spent in forums: 3 h 27 m 56 sec
Reputation Power: 0
|
|
|
Symbol error???
I have deveoped a Python program of about 10,000 lines of code divided in 12 modules. It is an object oriented program that uses Turtle graphics and Tkinter user interface. I use Python version 2.7 on a Mac.
Now I have a serious problem. The program code is in princip as follows:
Code:
# Module Train_util
...
def check_the_name(...
...
return OK, err_text, err_reason
...
# Module B
import Train_util
tu = Train_util
...
class X() :
...
def method_Y( ...
...
OK, err_text, err_reason = tu.check_the_name( ...
...
Theese lines of code have worked correctly at least 100 times when testing. But suddenly after a simple change of the code some lines below the code above, the method check_the_name is not recognized. The error print out is:
Code:
OK, err_text, err_reason = tu.check_the_name( ...
AttributeError: 'module' object has no attribute 'check_the_name'
It seems to me that the name of method, "check_the_name", has been lost in a symbol table. Are there any restriction of the size of a symbol table? I have not seen anything about this.
Can you recommend a work around this problem. I have tried to alter the name (was "check_name" before). Divided the big module B (about 2000 lines) into two seperate modules. Nothing helped.
Note: I have had a similar problem in the intial phase of the project. Python did not recognize some global data. By reducing the amont of global data and put other data in an global object, gl, I got around the problem.
|