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

Jack Jansen Jack.Jansen@cwi.nl
Wed, 17 Mar 1999 22:22:00 +0100


Recently, Steve Spicklemire <steve@estel.uindy.edu> said:
> 
> 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.

Steve,
I don't have time right now to really dig into this, but I do have a
suggestion. If the plugin is a shared library, as most of them usually 
are, you could try adding an initialize() entrypoint (look in the cfm
or ppc loader section in codewarrior). In the initialize routine you
have access to the fsspec of the library/extension being loaded, so
you could add it to list of resource files being searched. Look at the 
tkinter module for an example of how this
works. initialize_with_resources is the function you're looking for,
and there's a bit more glue in the init_tkinter routine, if I remember 
correctly.

Once you have a known resource fork open you can make sure that the
correct STR#, Popt and GU<sigma>I resources are in there. Usually
simply dropping the executable (or library, or extension) on
EditPythonPrefs will do the trick.

If the extension isn't a shared library your best bet is to do
something similar in the startup code, but then you'll have to open a
file with a wellknown (to your extension) name.
--
Jack Jansen             | ++++ stop the execution of Mumia Abu-Jamal ++++
Jack.Jansen@cwi.nl      | ++++ if you agree copy these lines to your sig ++++
http://www.cwi.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm