embedding python

Alex K. Angelopoulos aka at mvps.org
Fri Dec 27 21:15:53 EST 2002


"Robin Becker" <robin at jessikat.fsnet.co.uk> wrote in message
news:OdQyQIA9c5C+EwA+ at jessikat.fsnet.co.uk...
> In article <aufv7t$6vgui$1 at ID-136433.news.dfncis.de>, Alex K.
> Angelopoulos <aka at mvps.org> writes
> >Robin,
> >
> >This may be utterly useless, but I'm tossing it out as an idea since some of
the
> >details seem to fit... Have you considered indirect embedding via the Script
> >Control on Win32?
> >
> >I'm saying this in utter ignorance of your problem and the API issues with
> >direct Python embedding; nevertheless, the Script Control can be used to host
> >any scripting language registered on the system, and effectively isolates
> >language issues from your immediate sphere of concern.  This should minimize
the
> >interface work you have to do.
> >
> I know nothing of the scripting control. It probably does what our
> interface DLL does. I assume you feed it a script. How do scripts
> communicate back? The intended app will likely be given a script that
> uses ReportLab to draw a chart and render it into eps, the script will
> pass the eps bytes back to the caller.
>
> I'll certainly have a look at the Scripting Control, but I fear the
> intended platform isn't win32 (probably mac).

In that case, you may not want to bother.  Microsoft's Script Control is a COM
object, and it takes the drudgery out of embedding scripting abilities on Win32,
making language-specific support utterly irrelevant even - you deal with the
interfaces exposed by msscript.ocx, and don't worry about anything else, since
any language engine can talk back to the control.

Unfortunately, this is totally Windows-centric; merely contemplating another
platform makes this idea undesirable.

===========================

I think this is a dead end for your purposes, but I'm giving a brain dump on
this below since you asked. Someone else looking this over via Google may find
it useful, and it tied to Python history via Mark Hammond. ;)

Some details on the "Script Control" are available in the Microsoft Platform
SDK, and several examples can be found at support.microsoft.com - the search
engine sucks, so I would suggest doing a browse of that site from Google with
the phrase Script Control.  The core file is msscript.ocx, and it depends on
Active Scripting language engines.  The basic idea is that you instantiate it,
then set the language it will use by name, and add code to it on the fly.

Related to this is the Active Scripting interfaces in general; there is a set of
header files in the SDK defining interfaces for host applications to use; they
all appear to start with ActivScpxxxx as their names.  Based on appearances, I
think at least one reason the Script Control was developed was to address
difficulties people had in implementing support for scripting via the SDK
material.

Python was one of the first non-MS languages to implement Active Scripting, and
there are a few resources floating around about it on the Internet.  In fact,
Mark Hammond did a few write-ups on this and his basic material is some of the
more useful public info I have seen, even though it is now all 4-5 years old.
Looking for "Hammond", "Python", and "Active Script" should turn up some of
those.





More information about the Python-list mailing list