[Pythonmac-SIG] py2app with wxpython

Ned Deily nad at acm.org
Mon Feb 21 13:00:31 CET 2011


In article <4D624D92.5070608 at etrix.com.au>,
 "Brendan Simon (eTRIX)" <brendan.simon at etrix.com.au> wrote:
> I tried again with my Python 2.5.4 install and that does have the problem.
> 
> "pythonw myapp.py" works fine.
> 
> "python myapp.py" fails with the following error.
> 
> Traceback (most recent call last):
>   File "myapp.py", line 18, in <module>
>     import main as myMain
>   File "/Users/brendan/src/main.py", line 19, in <module>
>     from theapp import MyApp
>   File "/Users/brendan/src/theapp.py", line 20, in <module>
>     import wxAnyThread
> ImportError: No module named wxAnyThread
> 
> It looks like it is just a path issue.  So it should be easy to solve,
> but there is a difference in behaviour between python and pythonw with
> Python 2.5.4, even though the binaries are identical.  I presume that
> the the interpreter looks at the command that it is invoked with and
> does something different with sys.path ??

That still seems suspicious. If you are using Python 2.5.4 from the 
python.org installer, it also installs identical bin/python2.5 and 
bin/pythonw2.5 binaries, with bin/python and bin/pythonw as symlinks to 
the versioned names.  So all four names *should* behave identically, 
assuming all the names are being picked up from the framework bin 
directory, /Library/Frameworks/Python.frameworks/Versions/2.5/bin.  Make 
sure you are really using them:

  which pythonw
  which python

If necessary, you may need to specify absolute paths to the bin 
directory or temporarily change your shell PATH to ensure the 2.5 bin 
directory comes first (note, that Apple ships its own version of Python 
2.5, linked in /usr/bin, in both OS X 10.5 and 10.6).

-- 
 Ned Deily,
 nad at acm.org



More information about the Pythonmac-SIG mailing list