Python script shows different pythonpath

Posted by Bird Jaguar IV on Stack Overflow See other posts from Stack Overflow or by Bird Jaguar IV
Published on 2012-10-21T15:59:55Z Indexed on 2012/10/21 17:01 UTC
Read the original article Hit count: 246

Filed under:
|
|
|

Attempting to run runsnake gives

ImportError: No module named wx 

Opening an ipython or python session seems to work fine:

>>> import wx
>>> import sys
>>> print [p for p in sys.path if 'wx' in p]    
['/usr/local/lib/wxPython-2.9.4.0/lib/python2.7/site-packages', '/usr/local/lib/wxPython-2.9.4.0/lib/python2.7/site-packages/wx-2.9.4-osx_cocoa', '/usr/local/lib/wxPython-2.9.4.0/lib/python2.7/site-packages/wx-2.9.1-osx_cocoa/tools']

as does putting that code in a script and calling python script.py. But putting that code at the beginning of runsnake.py prints an empty list (printing the whole sys.path prints a path quite different from my $PYTHONPATH).

Why would it be different, and how to I get it to recognize wxPython?

© Stack Overflow or respective owner

Related posts about python

Related posts about path