NameError: global name 'btn_Matlab' is not defined ?

Stef Mientki stef.mientki at gmail.com
Tue Dec 28 08:34:19 EST 2010


hello,

Never seen this before and I've no explanation whatsoever (Python 2.6)

I've some dynamic generated code,
one of objects generated is a wx.Button, called 'btn_Matlab'.

After the code is generated, I can see that the button is created in the local namespace
 
   print locals()['btn_Matlab']

<wx._controls.Button; proxy of <Swig Object of type 'wxButton *' at 0x3602d28> >

but if I try to print the button (at exactly the same location), I get an error

    print btn_Matlab

NameError: global name 'btn_Matlab' is not defined ?

Why isn't the compiler first checking the local namespace ?
any clues ?

thanks,
Stef Mientki



More information about the Python-list mailing list