import wx works interactive but not from script

J

jefm

when I call "import wx" from the interactive console, it works (i.e.
it doesn't complain).
But when I call the same from a script, it complains that it can not
find the wx module.

------------works for interactive----------------------------
Python 2.6.1 (r261:67517, Dec 4 2008, 16:51:00) [MSC v.1500 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
------------does not work frm script--------------------------
Traceback (most recent call last):
File "c:\temp\myscript.py", line 4, in <module>
import wx
ImportError: No module named wx


I run Vista Home premium 64bit. Python 2.6.1 (the 32-bit version).
I installed the latest 32-bit ANSI version of wxpython. (http://
downloads.sourceforge.net/wxpython/wxPython2.8-win32-ansi-2.8.9.1-
py26.exe)
In the folder C:\Python26\Lib\site-packages, I find a wx.pth file with
a single line in there: "wx-2.8-msw-ansi"
in that same directory is a folder named "wx-2.8-msw-ansi" and it
contains a subdirectory called "wx" with what appears to be the
regular wx libary stuff, including __init__.py
My PATH starts with C:\Python26;C:\Python26\Scripts;C:\Python26\lib;

any idea's ?
 
T

Tim Golden

jefm said:
when I call "import wx" from the interactive console, it works (i.e.
it doesn't complain).
But when I call the same from a script, it complains that it can not
find the wx module.

------------works for interactive----------------------------
Python 2.6.1 (r261:67517, Dec 4 2008, 16:51:00) [MSC v.1500 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
------------does not work frm script--------------------------
Traceback (most recent call last):
File "c:\temp\myscript.py", line 4, in <module>
import wx
ImportError: No module named wx


Do you have only the one version of Python on this
machine? Did you upgrade from, eg, Python2.5? And
are you running this script by, eg, double-clicking
on it / running it from the command prompt with the
script name alone? If so, check that ftype python.file
shows that .py files are associated with the version
of Python you expect.

TJG
 
J

jefm

I ran the script from a command line, so it is not a file association
thing.
I do have multiple versions of Python installed on that machine. I
will uninstall them all and install a single version from clean.
Thanks for the suggestion
 
T

Tim Golden

jefm said:
I ran the script from a command line, so it is not a file association
thing.

Ummm... if you ran it by just typing the script name --
c:\test\whatever.py rather than c:\pythonxx\python c:\test\whatever.py --
then it certainly could be a file association issue.
I do have multiple versions of Python installed on that machine. I
will uninstall them all and install a single version from clean.
Thanks for the suggestion

Hope it helps. Let us know how it turns out.

TJG
 
J

jefm

ok, sorry for the long wait.
I tried this on both my work (XP) and home PC (Vista64) and they are
both consistent.

I had both Python2.6 and Python 3.0 installed.
wxPython didn't like that.
As soon as I uninstalled Python3.0, my wxPython started running again.
Must be some kind of registry thing.

Thanks for the suggestion.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,756
Messages
2,569,533
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top