[Pythonmac-SIG] xcode problems

Ronald Oussoren ronaldoussoren at mac.com
Fri Oct 20 09:26:17 CEST 2006


 
On Friday, October 20, 2006, at 08:29AM, Muhammad Alkarouri <malkarouri at yahoo.co.uk> wrote:

>---  Ronald Oussoren wrote:
>...
>> I'd drop Xcode unless you already know it, Xcode can be used as a  
>> python editor but is really heavy-weight for what it offers to Python  
>> programmers (it's great for ObjC programming, but most of Xcode is  
>> closed for Python programmers).
>
>Noted. I am at the moment trying TextWrangler for editing Python. May be I will
>revert to Idle.
>[rant]
>It is a shame, though. Xcode is a great python environment, as far as my
>experience goes. It would be far more useful if it were open source.
>[/rant]

Open Source is not relevant for that, having a public API is. I (and other people) have asked for this, but this isn't a very high priority for Apple (AFAIK). 

What I'd like to see in a future version of Xcode is a public plugin API (outright Python support would also be nice of course) and an tool for creating/maintaining project templates.

>
>> > - The next problem is in the code itself. When trying to run the  
>> > application
>> > PyAverager I get an error:
>> > PyAverager[3377] Unknown class `Averager' in nib file, using  
>> > `NSObject' instead
>> 
>> Where did you find this example? It isn't part of the PyObjC  
>> distribution, so I can't help you here without further information.
>
>Yes. This is the example from the Apple web site
>(http://developer.apple.com/cocoa/pyobjc.html).
>I did find the error, though, and it is an xcode peculiarity/bug. Namely, when
>you create a new Python class file in xcode it doesn't get added to "Classes"
>in the xcode project. You have to drag it there manually.

That's the lack of Python support in Xcode again.

>
>> > - Is there anyway to automate the change of setup.py to use
>> > /usr/local/bin/python at each new project, rather than doing it  
>> > manually?
>> 
>> The 2.4.3, 2.4.4 and 2.5 installers for python should ensure that the  
>> right directory (which isn't /usr/local/bin b.t.w.) is on $PATH. What  
>> is your shell environment? I assume you use the default shell (bash),  
>> do you have any custom startup files  
>> (.profile, .bashrc, .bash_login, ...)?
>
>I have installed the Python 2.5 for OS X from python.org. And I have this now
>
>==================
>muhammad-alkarouris-computer:~ malkarouri$ which python
>/Library/Frameworks/Python.framework/Versions/Current/bin/python
>muhammad-alkarouris-computer:~ malkarouri$ ls -l /usr/local/bin/python
>lrwxr-xr-x   1 root  wheel  68 Oct 15 06:13 /usr/local/bin/python ->
>../../../Library/Frameworks/Python.framework/Versions/2.5/bin/python
>muhammad-alkarouris-computer:~ malkarouri$ echo $PATH
>/Library/Frameworks/Python.framework/Versions/Current/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/teTeX/bin/i386-apple-darwin-current
>muhammad-alkarouris-computer:~ malkarouri$ cat .bash_profile 
>
># Setting PATH for MacPython 2.5
># The orginal version is saved in .bash_profile.pysave
>PATH="/Library/Frameworks/Python.framework/Versions/Current/bin:${PATH}"
>export PATH
>muhammad-alkarouris-computer:~ malkarouri$ 
>==================
>
>So, the installer did install /usr/local/bin/python. Through .bash_profile,
>python2.5 is the default for my shell, while python2.3 is the default for
>everything else. This is fine by me. I assume that is the right approach. Or is
>there another installer?

Ah, now that you mention it: Xcode doesn't look at the shell environment, and that is the only thing that is patched. If you know you're way around Xcode this is fixable: the templates currrently run '/usr/bin/env python', that should be changed to '/Library/Frameworks/Versions/Current/bin/python' (or .../Versions/2.5/bin/python to ensure you get python 2.5).

>
>> It would be nice if that button worked, but I don't have time to fix  
>> this. Making changes to the xcode templates is no fun, even if you do  
>> know how to do so  which I don't.
>> 
>> PyObjC is a bit in flux at the moment, we've transitioned to  
>> setuptools but never got around to completely finishing that  
>> transition, which explains the lack of binary installers.
>
>Keep up the good work. For now, PyObjC 1.4 source installation for both Python
>2.5 and Python 2.3 are working fine.

Ronald


More information about the Pythonmac-SIG mailing list