global name 'config' is not defined

I just installed the latest version of Panda3D and I already have Python25 installed on my machine. I’ve put a panda.pth file in my \Python25\lib\site-packages\ folder with the following:

c:/Panda3D-1.5.2
c:/Panda3D-1.5.2/bin

Checking sys.path produces the following:

['C:\\Python25\\Lib\\idlelib', 
'C:\\Python25\\lib\\site-packages\\setuptools-0.6c8-py2.5.egg', 'C:\\Python25\\lib\\site-packages\\pyopengl-3.0.0b2-py2.5.egg', 'C:\\WINDOWS\\system32\\python25.zip', 'C:\\Python25\\DLLs', 'C:\\Python25\\lib', 'C:\\Python25\\lib\\plat-win', 'C:\\Python25\\lib\\lib-tk', 'C:\\Python25', 'C:\\Python25\\lib\\site-packages', 'C:\\Python25\\lib\\site-packages\\PIL', 'C:\\Python25\\lib\\site-packages\\directpy', 'c:\\Panda3D-1.5.2', 'c:\\Panda3D-1.5.2\\bin', 'C:\\Python25\\lib\\site-packages\\wx-2.8-msw-unicode']

So far so good. However, when doing the most simple test, using this code:

import direct.directbase.DirectStart

run()

I receive the following error (using WingIDE as my Python IDE):

NameError: global name 'config' is not defined

Here is the callstack from WingIDE if it helps:

test.py, line 1, in <module> import direct.directbase.DirectStart

DirectStart.py, line 3, in <module> from direct.showbase import ShowBase

ShowBase.py, line 10, in <module> from pandac.PandaModules import *

PandaModules.py, line 5, in <module> from libp3directModules import *

libp3directModules.py, line 16, in <module> notify = directNotify.newCategory("Interval")

DirectNotify.py, line 53, in newCategory self.setDconfigLevel(categoryName)

DirectNotify.py, line 70, in setDconfigLevel config

FWIW, I can run the sample programs that come with Panda3D from the Start Menu, however, it always asks where my Python.exe is.

This appears to be some type of path or setup issue, but I’m not quite clear where the problem is. Any ideas?

Thanks!

Fascinating. Looking at the line in question that seems to be generating the error (line 70 of DirectNotify.py), I see:

        try:
            config
        except:
            return 0

This code is supposed to be checking for the existence of the global symbol ‘config’. It gets created at some point during system startup. Line 70 is the reference to ‘config’ itself.

If there were no try/except around line 70, then it would certainly generate the error you describe every time. However, here’s the kicker: there is a try/except. So the error should have been caught by the except condition, which is supposed to ignore it.

Somehow your Python is not catching the exception, when running under WingIDE? How can this be?

David

You know, you are completely right. For some reason I wasn’t even paying attention to the try/catch issue.

I think this might be a Wing problem because I just tried running my test outside of Wing and it worked. wtf…

Hello

I get the same error if I try to debug my Panda program in WingIDE (professional, try, I plan to buy it, if I get it to work).
I can debug in Eclipse (but Eclipse gives me other funny errors, has indentation problems and all in all doesn’t feel nice and streamlined).
So if anybody got WingIDE to debug Panda3d code please help. I will try to get it work myself and will post if I get anywhere. If anybody from Wingware lurks around here, your chance to grab a customer :wink:.
By the way, just executing works.

Ok for the lazy ones. WingIDE does let me ignore this exception location. Nifty, I can debug.

Yea, I just found out how to ignore the NameError’s in Wing, that get around this problem. In Wing, go to Edit > Preferences > Debugger > Exceptions and remove the NameError item.

Thanks jhayes. You actually told everyone HOW you got past the error, rather then the previous poster that just said “Oh I solved the issue”