[Pythonmac-SIG] Director Python plug-in.... Mac Port

Steve Spicklemire steve@estel.uindy.edu
Wed, 17 Mar 1999 12:50:46 -0500 (EST)

I've had a little time to work on the Mac port of my Xtra for Director.
The readme follows. The code is at http://opensource.spvi.com. Any help
with the project would be really appreciated. The Problem now seems to
be getting the PYTHONPATH from the correct resource from within the
plugin. I don't know enough about Mac resources to instantly figure
this one out. I'm guessing it's because the application that's using
the XTra is not Python, but Director. I think I've correctly included
all the Python resources in my XTra project. I'm building a 'standalone'
Xtra (not using the PythonCore library) since that seems to cause all
sorts of problems..... and was difficult to debug.

thanks for any ideas!


Hi Folks,

I'm happy, but mildly embarrassed (at the current state of the code) to say
that one of my customers, Thomson Consumer Electronics, has agreed to allow
me to release the source to a tool I've developed to help me help them...
it's a (crude) Python XTra for Macromedia Director.  This is a very eary,
crude, but useful Scripting XTra that allows you to use Python from within
Macromedia Director.  There are only a few commands

From the current CREGISTER.CPP

static char msgTable[] = {
        "xtra XPython\n" \
        "new object me\n"  /* standard first handler entry in all message tables */
        "-- Template handlers --\n"
        "* PyRun_SimpleString string command -- processes one Python command\n"
        "* Py_Initialize  -- Initializes Python\n"
        "* Py_GetObject string objectname  -- get a string from python\n"
        "* Py_GetList string listname -- get a list from python\n"

So you can put the XTra in your XTras folder and:

Py_Initialize()                  -- init the interpreter..
PyRun_SimpleString("x = Spam()") -- call the Python interpreter
Py_GetObject("x")                -- retrieve the object called 'x'... only works with strings now..
Py_GetList("parrots")            -- get a list of strings...

(assuming you already have Python installed).

I need all the help I can get...

1) Make the 'Py_GetXXX' functions more general, functional, safe....

2) Do the 'extension' half of this.. so that you can manipulate Director
        objects from withan a Python script.

3) Get the Mac port working.... I've made some progress on this front.
   I've included the current state of the project with this release.
   There is a file XPython.sea that includes my source tree. You will
   need the Python sources from Jack's ftp site:
        ftp://ftp.cwi.nl/pub/jack/python/mac (These go in the "Python 1.5.2b1
        src", and CWGUSI as described in the buildmac document that comes
        with Jack's sources....)

   The XDK from macromedia:
    (This goes in the XDK folder.. you should only need 'includes')

        My stuff goes in the 'XPython' folder. Right now the plugin is
        crashing when it tries to snoop through the resources to discover
        the PYTHONPATH.

This is being released as OpenSource... do anything you like but let me know
if you find bugs or want to contribute improvements! I'd be more than happy
to incorporate good stuff back into this code. For my part I'll do my best to
maintain the sources and make new XTras available as they are created.

Steve Spicklemire
Silicon Prairie Ventures, Inc. (and) University of Indianapolis
steve@spvi.com                       steve@estel.uindy.edu
Software/Hardware Development        Physics and Earth-Space Science
(317) 917-1411                       (317) 788-3313