[wingide-users] Module loading problem

Wingware Support support at wingware.com
Mon Jan 11 08:52:09 MST 2010

Alan Harris-Reid wrote:
> Using  Wing IDE (3.2 personal) debugger with Python 3.1, I am trying 
> to run the following code...
> import constants
> var = constants.testvar
> and I get the following error...
> builtins.AttributeError: 'module' object has no attribute 'testvar'
> The variable testvar definitely exists in my constants.py module.
> I notice there is a file constants.pyc in
> C:\Program Files\Wing IDE Personal 3.2\bin\3.1\src\debug\tserver\.  
> Could this be preventing my constants file from loading?  I ask 
> because when I change the name of my constants file (eg. to const.py) 
> the code runs without error.  If this is the cause of the problem, how 
> can I fix things so I can call my module constants.py?

Yes, I think you are getting a module named constants.py that is part of 
Wing IDE's debugger. Unfortunately the only way to work around this for 
now, is to make changes in your own code. You could, for example, change 
the imports to use relative paths. For example, "import .constants" or 
"import ..constants".

Another idea would be to alter sys.path, which probably has the 
directory C:\Program Files\Wing IDE Personal 
3.2\bin\3.1\src\debug\tserver\ on it.

This may be a bug only when running under Python 3.x. We'll look into 
fixing it, and plan to try to more completely isolate the debugger 
modules from the user code in the next major release of Wing (but not in 
Wing 3.2, because the changes are too large for me to feel comfortable 
making them in a point release).



Stephan Deibel
Wingware | Python IDE
Advancing Software Development


More information about the wingide-users mailing list