[Pythonmac-SIG] xcode problems

Muhammad Alkarouri malkarouri at yahoo.co.uk
Thu Oct 19 04:27:25 CEST 2006


Hi everyone,

I am a newbie in the Mac world, having bought my first Mac Mini a couple of
days ago. I promptly went on to find out about Python programming there.

I installed Python 2.5 from python.org, so I have it besides 2.3. I also
installed xcode 2.4. That is on OS X 10.4.8. Then I tried to follow "Using
PyObjC for Developing Cocoa Applications with Python". Here is where small
problems crop up. I would like to know the right solution about (some of) these
problems.

- Using xcode I followed the tutorial. I wasn't able to build. I get build
failed with No module named py2app. I understand this comes with PyObjC so I
tried to install that again. The installer for PyObjC 1.3.7 from
http://prdownloads.sourceforge.net/pyobjc/pyobjc-1.3.7-py2.3-macosx10.4.zip?download
gives me an error on import along the lines of unable to import due to "mach-o,
but wrong architecture". I tried PyObjC 1.4 from source but it wasn't able to
install due to a permission error. I didn't try to investigate that, especially
as there is no binary for python 2.3 so I figured that something was amiss.
Anyway, I tried to use Python 2.5.

- To use Python 2.5 I installed PyObjC 1.4. The installation went smoothly. I
had to modify setup.py to use /usr/local/bin/python following a hint somewhere
the internet. Now "Build and Go" wasn't working (why?). Following another hint
I mad a custom executable like "/usr/bin/env
PyAverager.app/Contents/MacOS/PyAverager". This is now working.

- 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
...
NSUnknownKeyException - [<NSObject 0x1427590> valueForUndefinedKey:]: this
class is not key value coding-compliant for the key numbersInput

So the nib (whatever that is) cannot find the class Averager.
By going to the source of PyAverager I noticed that the Averager module is
imported indirectly, as in:

for pythonModule in info[u'Modules']:
    __import__(pythonModule)

If I do "import Averager" or "__import__('Averager')" after these lines the
application runs successfully. So I guess that info[u'Modules'] doesn't contain
'Averager'.

So the important questions for me now are:
- 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?
- Shouldn't "Build and Go" be working automatically? Or is there anyway to
automate the creation of the custom executable for each new python project?
- Why doesn't Averager in the example get imported automatically? Probably I
did something wrong here, but I don't know what.

These are my problems with Python 2.5. I guess I am not going to use Python 2.3
anyway, so it would be nice but not essential to know about the solution to my
problems with it.

Sorry for the long e-mail, but I figured that some of my problems might be
known issues and/or bugs as well, so I better document these for others.

Thanks a lot,

k

Send instant messages to your online friends http://uk.messenger.yahoo.com 


More information about the Pythonmac-SIG mailing list