OSA.so (was: Re: [Pythonmac-SIG] CFURL Pain)
hengist.podd at virgin.net
Thu Mar 3 16:30:06 CET 2005
Donovan Preston wrote:
> > No, I wanted a Python OSA component. Different thing. The only person
> > I know was asking for an OSA wrapper was Donovan, and he went off to
> > work on Nevow yonks ago and AFAIK never did anything with it.
>I wanted an OSA module so that it would be possible to write a Python
>OSA component using a more inside out approach.
There's basically two halves to OSA. One half is used to implement
OSA language components. The other half allows client apps to use
OSA.so implements the API for the second of these, allowing Python to
load and execute scripts written in any OSA language. The Carbon
equivalent to Cocoa's NSAppleScript, except with a much more powerful
and much less friendly API.
To implement a PythonOSA component, you need to write a C wrapper
around the Python interpreter's C API . That wrapper then exports
a bunch of callbacks (UUPs to be precise) that OSA calls to
compile/decompile/execute/load/store/etc a Python script on behalf of
a client. I don't think there's anything in OSA.so that'd help with
I've been looking at OSA.so recently as I'd like to implement
attachability in a PyObjC-based app I'm writing and NSAppleScript is
too limited for what I want to do. While I've occasionally given the
PythonOSA problem a passing glance, it's not something I'm as
interested in solving myself as I haven't had any personal need for
it to date and my C isn't good enough anyway.
>I am still interested in producing a Python OSA component, hopefully
>with the OSA module, but unfortunately it is a lot more work than I
>have free time for at the moment. I lost my drive to work on it when it
>became clear that HAS was far more energetic in this space than I was,
>and HAS didn't seem willing to listen to what I had to say about the
>subject or collaborate with anybody.
I do remember being very grateful for advice when I was starting out
on appscript. Can't recall ever being anti-collaborative or that; I
may be abrasive and critical and behave differently to other
programmers, but then I'm from a different background so maybe there
was some accidental culture clash? Apologies if any offence was
caused; it certainly wasn't intentional.
 It might be possible to write a smaller C wrapper that allows you
to install Python functions as callbacks for handling the
compile/decompile/execute/etc. stuff within Python using exec and
friends rather than doing the whole lot in C, which might be a bit
more convenient than doing everything in C. I don't know enough about
how the Python interpreter works to say if this would be practical or
More information about the Pythonmac-SIG