2
votes

I'm having problems installing pyobjc on SnowLeopard.

It came with python 2.6 but I need 2.5 so I have installed 2.5 successfully. After that I have installed xcode. After that I have installed pyobjc with "easy_install-2.5 pyobjc"

But when I start my python 2.5 and from cmd line try to import Foundation, it says "no module named Foundation"

I tried to do export PYTHONPATH="/Library/Python/2.5/site-packages/pyobjc_core-2.2-py2.5-macosx-10.6-i386.egg/objc" before starting python interpreter but still no luck (this .egg directory is the only directory pyobjc installation made, and there are several more egg files there in site-packages... in objc subdir there is init.py file)

Of course, from 2.6 everything works fine. How do I find out what's wrong and what should i do?

When I print sys.modules from python 2.6 I find that objc that gets imported is basically from the same install location "/Library/Python/2.6/site-packages/pyobjc_core-2.2-py2.6-macosx-10.6-universal.egg/objc/", so why it won't work for 2.5?

1

1 Answers

4
votes

Ok, found what's wrong.

My SnowLeopard came with BOTH python 2.6 (default) and 2.5 installed

XCode installed objc for both.

So basically I have broken my pythonpath etc with additional python 2.5 and objc manual installations, somehow libraries weren't compatible (mine and original python are both 2.5.4 but slightly different release and what's more important probably built with different build options)

What I did is: making sure I start everything with original python2.5 (on my system it's in /usr/bin/python2.5), removing wrong entries from easy_install.pth in site-packages, and adding the path to PyObjc to easy_install.pth.

Sorry for not finding out sooner, but I hope this will be helpful to someone in the future!