Re: [Pyobjc-dev] Calling Python code from Cocoa bundle
Brought to you by:
ronaldoussoren
From: <li...@po...> - 2004-03-13 18:29:01
|
On 13.03.2004, at 18:44, Bob Ippolito wrote: > 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=20 >> within 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=20= > is already loaded somehow by the Obj-C runtime: > > import objc > Abstract =3D objc.lookUpClass('Abstract') Works like a charm. Thanks, Bob! Cheers, -Ralph. |