On Oct 19, 2006, at 4:27 AM, Muhammad Alkarouri wrote:

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.

There currently is no proper binary installer for PyObjC. I hope to have some time soon to work on that, but don't hold your breath.


- 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.

I'd drop Xcode unless you already know it, Xcode can be used as a python editor but is really heavy-weight for what it offers to Python programmers (it's great for ObjC programming, but most of Xcode is closed for Python programmers).


- 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

Where did you find this example? It isn't part of the PyObjC distribution, so I can't help you here without further information.

...
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.

A nib file is the output format of Interface Builder, which is the GUI designer for OSX. It is basically a pickled object graph for a GUI.

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?

The 2.4.3, 2.4.4 and 2.5 installers for python should ensure that the right directory (which isn't /usr/local/bin b.t.w.) is on $PATH. What is your shell environment? I assume you use the default shell (bash), do you have any custom startup files (.profile, .bashrc, .bash_login, ...)?

- 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?

It would be nice if that button worked, but I don't have time to fix this. Making changes to the xcode templates is no fun, even if you do know how to do so which I don't.

PyObjC is a bit in flux at the moment, we've transitioned to setuptools but never got around to completely finishing that transition, which explains the lack of binary installers.

Ronald

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig

Reply via email to