I've been having issues with getting eclipse to use the wxPython library.
First of all the python command shell imports and uses the library without any problems.
Eclipse doesn't give an error when importing, but gives one when trying to use anything inside the library.
For example, the following code work outside of eclipse:
app = wx.PySimpleApp()
frame = wx.Frame(None, -1, "Hello World")
But in eclipse the following errors are given:
Undefined variable from import: Frame
Undefined variable from import: PySimpleApp
What's most puzzling is when I run the following in eclipse:
for i in dir(wx):
All the classes are printed out fine, including the Frame class that it claims doesn't exist.
I've tried adding everything I can think of to the PYTHONPATH, but nothing works.
Adding the wx folders, the wx.pth file, nothing works. I've tried searching google and this forum, but no solutions have come up. Any ideas?
Here, having 'wx' in the forced builtin makes it work (it's actually there by default). So... can you give some details on your installation?
- What's your OS
- Eclipse / Pydev version
- Do you have something in your error log? (see http://pydev.sourceforge.net/faq.html#how_do_i_report_a_bug to know how to get it)
Just realized after posting I forgot those details.
Os: Windows Vista
Eclipse version: 3.2.2
Pydev Version: 1.3.12
Ok, after checking my error log, eclipse suddenly decided to recognize the library.
I have no idea how or why, after having saved/restarted the application many times etc.
So I guess now I'm good to go. Thanks for the extremely speedy response.
Just for future reference, any ideas as to what this may have been caused by?
Also, where is this forced builtin you mentioned? Is it the same thing as the pythonpath?
Check http://fabioz.com/pydev/manual_101_interpreter.html for details on forced builtins (and how to properly configure your pythonpath)
The usual problem in that is a misconfiguration on the pythonpath or a blocking firewall to the shell that actually gets the tokens.