import wx works interactive but not from script

Tim Golden mail at timgolden.me.uk
Tue Feb 10 04:10:18 EST 2009


jefm wrote:
> 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.
>>>> import wx
>>>>
> 
> ------------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



More information about the Python-list mailing list