Re: Python Xcode project cannot find objc
Re: Python Xcode project cannot find objc
- Subject: Re: Python Xcode project cannot find objc
- From: email@hidden
- Date: Fri, 09 Jan 2009 08:36:22 -0500
On Jan 9, 2009, at 6:33 AM, Mark Dancer wrote:
Hi,
This is my first attempt to use Xcode (I have been using Python for
some time, but I’m just starting with Xcode).
I created the simplest Python project I can (a Python-Cocoa
Application), compile the project and run it. I’ve made exactly one
change to the files Xcode generates: I added the line # coding=utf-8
to main.py, otherwise Python complains about the Xcode generated
comments.
Running the project dumps me into GDB with a
__TERMINATING_DUE_TO_UNCAUGHT_EXCEPTION__ from main.m, which is
raised by the lines:
if ( result != 0 )
[NSException raise: NSInternalInconsistencyException
format: @"%s:%d main() PyRun_SimpleFile failed
with file '%@'. See console for errors.", __FILE__, __LINE__,
mainFilePath];
Tracking back through the console, I find the Python interpreter has
barfed:
Traceback (most recent call last):
File "/Users/aelfric/Testing/build/Release/Testing.app/Contents/
Resources/main.py", line 11, in <module>
import objc
ImportError: No module named objc
2009-01-09 21:05:25.860 Testing[1528:10b] *** Terminating app due to
uncaught exception 'NSInternalInconsistencyException', reason: '/
Users/aelfric/Testing/main.m:44 main() PyRun_SimpleFile failed with
file '/Users/aelfric/Testing/build/Release/Testing.app/Contents/
Resources/main.py'. See console for errors.'
2009-01-09 21:05:25.865 Testing[1528:10b] Stack: (
2501242304,
2506384620,
2501242064,
2501242120
)
Source code producing this error is from main.py:
# coding=utf-8
#
# main.py
# Testing
#
# Created by Ælfric on 09/01/2009.
# Copyright __MyCompanyName__ 2009. All rights reserved.
#
#import modules required by application
import objc
My understanding is that objc is park of PyObjC, which I understand
is now installed as part of Xcode (and has been since Xcode 3.0?).
My Xcode install was vanilla (default install to the default
locations), so I’m scratching my head as to where I’ve gone wrong.
Any suggestions?
• Mac OS X 10.5.6
• Xcode 3.1.2
Cheers,
Mark Dancer
email@hidden
You most likely have multiple copies of Python installed on your
machine and the one Xcode is finding is not the one in /usr/bin/python
(which on Leopard is a symbolic link to /System/Library/Frameworks/
Python.framework/Versions/2.5/bin/python)
To double-check your system is ok, you could type in a Terminal:
/usr/bin/python
and then in the Python shell:
import objc
That should not give an error. If it does, you have problems with your
system.
Dave
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden