wxPython

hallo,

somebody can explain me why i cannot import wxPython in blender?
if i do
from wxPython import wx it reply me with this error:
ImportError: No module named wxPython
but in the python shell and in Spe the module wxPython is imported
and in Blender I import successfully modules like MySQLdb e sqlite that are in dir \Lib\SitePackages of python
the PYTHONPATH è setted to D:\python23
if I do in blender
import sys
print sys.path
I have:
[‘D.\Program Files\Blender Foundation\Blender\python23.zip’,
‘D:\Python23\Lib’, ‘D:\Python23\DLLs’, ‘D:\Pytohn23\Lib\lib-tk’, ‘’,
‘D:\Program Files\Blender Foundation\Blender’, ‘D:\PROGRA~1\BLENDE~1\Blender’, ‘D:\Python23’. ‘D:\Python23\lib\site-packages’ , ’ d:\Python23\Lib\’, ‘D:\Program Files\Blender Foundation\Blender\.blender\scripts’]

in blender in the user preferences I have set the default directory of python to : D:\python23\Lib\ and I’m using wxPython2.5.3

where is the error?
thanks

Not sure about this, but…
Have you tried putting the file in the same dir as the Blender executable, or the dir of the Blend file (if Blender gets started by double clicking the Blend file)

The error is on Blenders side. Blender doesn’t recognize .pth files. Therefore you can use the following patch, which I also used for SPE.

import sys,os
site_packages   = os.path.join(sys.prefix,'Lib','site-packages')
wx_pth          = os.path.join(site_packages,'wx.pth')
if os.path.exists(wx_pth):
    sys.path.append(os.path.join(sys.prefix,'Lib','site-packages',open(wx_pth).read()))

You can report this bug to the bf-python mailing list, as I did some months ago. Good luck!

Stani

http://www.stani.be

very thanks Stani you are great

I have solved this copying the dir wx and wxPython in the blender directory
it works

but your method is surely better
thanks