Setting up: OS X 10.6.6 + XCode3.2 using python and cocoa

300 views Asked by At

I am trying to set up working environment on OS X 10.6.6, XCode3.2, fink using python and cocoa frameworks. I scanned few references in the net, however nothing worked for me.

I have python2.6 installed via fink together with a pyobjc-py26. When I run a python shell in the terminal I get:

localhost:PyObjCTut stymek$ which python
/usr/bin/python
localhost:PyObjCTut stymek$ python
Python 2.6.1 (r261:67515, Jun 24 2010, 21:47:49) 
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import objc
>>>

Everything is OK.

When I try to build the basic code from the Xcode (e.g. 1. default Python + Cocoa template 2. example from here), the python is not able to find objc module. Why?

Traceback (most recent call last):
File "main.py", line 10, in <module>
    import objc
ImportError: No module named objc
1

There are 1 answers

0
honzikd On

I was struggling with almost similar troubles after manually installing Python version 2.7 and 3.X...

There's no such setting in XCode - the Apple-shipped Python (v2.6) needs to be the default one.

Also, check in the /System/Library/Frameworks/Python.framework/Versions - the 'Current' symlink needs to point to the default Python v2.6