List Info

Thread: Workaround: XCode fails to see py2app




Workaround: XCode fails to see py2app
country flaguser name
Germany
2007-09-17 10:59:11
The Problem:
------------
Building an python-project from xcode results in:
ImportError: No module named py2app
		ImportError: No module named py2app

maybe it arises only if more than one python-version are (or
have  
been) installed on the mac
where the building takes place. maybe only in combination
with  
installs of PyObjC with the
dmg-installers. I had not the possibility to verify these to
 
assumptions.

there has been the proposal to change the first line of
setup.py from
	#!/usr/bin/env python
to
	#!<insert absolute path of your python-interpreter>
somwhere on the internet. That works but is ---- *BAD* !!!! 

Programming Style ----.

I stumbled about the fact that the build worked when using
the  
teminal - even if i
used exactly the same Command and options, which xcode does.
The  
Difference turned
out to be the search-path of the user. My shell-environment
has the  
location of python
in it.
So instead of crunching the code of every setup.py i wrote a
shell- 
snippet named
xcode-pyhelper.sh as follows:

-------------script begins ----------
#!/bin/sh
PATH="/Library/Frameworks/Python.framework/Versions/Cur
rent/bin:$"
/usr/bin/env python $*
-------------script ends   ----------

i put it in my home-directory
/Users/my_username/bin/xcode-pyhelper.sh
and changed the project-build-preferences in xcode (while
project is  
open)
via
	project -> Edit active Target
	(window pops up, containing the string /usr/bin/env in the
field  
Build-Tool)
	changed the Build-Tool to my brandnew threeline-script
	/Users/my_username/bin/xcode-pyhelper.sh

Build works. This method is ugly too, but at least i do not
need to  
coding-style that
securely would fail on all non-mac Platforms (Or does
anybody else  
install python in *that*
location... ?).


adagio
_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIGpython.org
http://mail.python.org/mailman/listinfo/pythonmac-sig

Re: Workaround: XCode fails to see py2app
country flaguser name
United States
2007-09-18 17:48:06
Wolfram Eifler wrote:
> there has been the proposal to change the first line of
setup.py from
> 	#!/usr/bin/env python
> to
> 	#!<insert absolute path of your
python-interpreter>
> somwhere on the internet. That works but is ---- *BAD*
!!!!  
> Programming Style ----.

Agreed, but:

#!/usr/bin/env python2.5

Isn't so bad -- indeed, I like it, as it makes it quite
clear what 
version of python your code has been tested on.

Of course, python2.5 will have to be on your PATH for this
to work.

-Chris


-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barkernoaa.gov
_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIGpython.org
http://mail.python.org/mailman/listinfo/pythonmac-sig

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )