5

If you did, would you mind sharing how you did the pyobjc install? I was trying to do it by installing PythonMac 2.5 (for the standalone bundle thru py2app), and doing easy_install of PyObjC. I always get those deprecated errors, primarily those declared in dyld.h, and inside objc_inject.m.

I tried compiling from source but still no luck.

Also, when I run my Leopard-compiled PyObjC app under Snow Leopard, it has errors concerning PyObjC, first time was it can't see Foundation or AppKit, second was typestr is unknown.

Thanks and appreciate your answers.

chollida
  • 7,834
  • 11
  • 55
  • 85
jopes
  • 245
  • 2
  • 13
  • I thought PyObjC was built-in starting with Leopard? I did some very basic stuff with it a couple of years ago and didn’t have to install anything. – Nate Aug 24 '09 at 06:03
  • It is, but I'm trying to make a standalone app that works on both Leopard and Snow Leopard... with py2app, I only get semi-standalone apps using the System Python... – jopes Aug 25 '09 at 21:15

2 Answers2

4

If you install the XCode Developer tools (optional Snow Leopard install), there's no need to manually install PyObjC at all. Here's how you can test it:

$ python
Python 2.6.1 (r261:67515, Jul  7 2009, 23:51:51) 
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import Foundation
>>> Foundation.NSString.stringWithString_(u'hello PyObjC')
u'hello PyObjC'
>>> 

If the Foundation, AppKit, ScriptingBridge, modules can be imported, then everything is alright.

  • I would suggest using this method, it will make developing and testing much easier since you are using a standard system and standard python from Apple. – Astra Nov 05 '09 at 15:58
0

I already found a way... though I dunno if this is official or what...

I downloaded 2.5 version of PythonMac, installed it, and then added a symlink inside the installation directory, e.g.:

sudo ln -s /System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python /Library/Frameworks/Python.framework/Versions/2.5/lib/site-python

This part made it seem as if the bundled PyObjC binaries are part of the PythonMac installation, and when I do easy_install, the system site-packages won't get affected. Also, worth noting is that you shouldn't conflict the system-bundled py2app by easy_install-ing py2app or else you'll encounter a typestr error.

I wanna know if there's anything wrong with this for me to be able to make a standalone PyObjC application under Snow Leopard.

jopes
  • 245
  • 2
  • 13