[Pythonmac-SIG] "Wrong Architecture" problem with Xcode and PyObjC

Ronald Oussoren ronaldoussoren at mac.com
Mon May 14 15:42:31 CEST 2007


 
On Monday, May 14, 2007, at 02:18PM, <Benjamin.A.Smith at warwick.ac.uk> wrote:
>Hi,
>
>I'm a newbie to Python, so sorry if this is a little simple. I searched
>around for a few hours and tried variations solutions but to no avail.
>Hopefully somebody here might be able to point out what I've missed or
>where I've gone wrong!
>
>I recently decided to have a go at making a fairly simple Cocoa
>application using the PyObjC bridge. I'm using a new Macbook with an Intel
>processor.
>
>Following the Apple tutorial to using Cocoa with Python (found at
>http://developer.apple.com/cocoa/pyobjc.html) I installed the the PyObjC
>1.3.7 installer package for Python 2.3 on Mac OS X 10.4 package.
>
>I then went ahead and created a Python project in Xcode and, without
>making any changes, tried to build it. I got the following error:
>
>Tool:0: Command /usr/bin/env failed with exit code 1
>Tool:0:
>	/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/PyObjC/objc/_objc.so:
>mach-o, but wrong architecture
>Tool:0: ImportError:
>dlopen(/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/PyObjC/objc/_objc.so,
>2): no suitable image found.  Did find:
>
>
>This suggested to me that I was using a PPC build of Python or of PyObjC.
>I went ahead and installed Python 2.4.4 and as well as PyObjC 1.4 for
>(Universal) Python 2.4 on Mac OS X 10.4.
>
>The Python installation works fine, and I have run a number of scripts
>using it without  any errors. I ran the PyObjC installer mpkg and the
>installation appeared to go smoothly, giving me no problems whatsoever.
>
>I reopened Xcode and started another new Python application. However,
>building it whilst empty gave exactly the same error code as before! This
>suggests to me that Xcode is trying to use the same older files and is
>ignoring the newer, universal installations. However, I have no idea about
>how to change this, or indeed if this is actually the problem.

The short answer is that you have to update setup.py: the first line mentions the python interpreter that's used to build the application, change that to /usr/local/bin/python.

>
>I would really like to be able to use Xcode and Interface Designer with
>Python. My googling and various attempts to fix the problem or at least
>work out exactly what is the going on have been to no avail. If anyone has
>any ideas on how I might be able to get things rolling I would really,
>really appreciate it.

You don't have to use Xcode to use Interface Builder, although you may as well do so when you are comfortable with Xcode. IMHO Xcode isn't worth the  trouble when you're only using it for Python programming, something like TextMate or even command-line editors would be a much better match.

Ronald

>
>Sincerely,
>Benjamin Smith
>
>
>
>_______________________________________________
>Pythonmac-SIG maillist  -  Pythonmac-SIG at python.org
>http://mail.python.org/mailman/listinfo/pythonmac-sig
>
>


More information about the Pythonmac-SIG mailing list