Re: [Pyobjc-dev] Calling Python code from Cocoa bundle
Brought to you by:
ronaldoussoren
From: Bob I. <bo...@re...> - 2004-03-13 17:41:06
|
On Mar 13, 2004, at 6:21 PM, Ralph P=F6llath wrote: > I'm a python newbie and I'm trying to call a python method from within=20= > a Obj-c Cocoa bundle. > > I've worked around the "undefined symbol" problem > ( http://sourceforge.net/mailarchive/message.php?msg_id=3D7358512 ), > but python doesn't find my abstract Obj-C class and therefore won't=20 > let me subclass it: Python's module namespaces are mutable, but "stupid" and "fixed". =20 Basically, it won't search for additional things if your class is not=20 already in that namespace. Additionally, every module gets its own=20 namespace, very much unlike Obj-C where namespaces only exist by=20 "NSConvention". This is one way to add your Abstract class to the=20 current namespace, and it should work so long as your Abstract class is=20= already loaded somehow by the Obj-C runtime: import objc Abstract =3D objc.lookUpClass('Abstract') -bob |