Thread: Symbol error???

    #1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2012
    Posts
    5
    Rep 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:
    
    
    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.

  2. #2
  3. Contributing User
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2011
    Posts
    4,896
    Rep Power
    481
    As far as I know, and I have attended python conferences listening to developer talks, python doesn't impose arbitrary limits.

    I encourage unit tests and functional tests.
    See the attachment to post 4:
    http://forums.devshed.com/python-programming-11/dma-and-python-930972.html


    See post 3 for doctest example, or use the google search
    site:forums.devshed.com/python-programming-11 b49p23tivg doctest
    for more examples.


    I think your code is incorrect. And I don't know why. I could be wrong.
    [code]Code tags[/code] are essential for python code and Makefiles!

IMN logo majestic logo threadwatch logo seochat tools logo