1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
|
Python now runs in a Netscape window! Required files are all on
ftp.interet.com and mirrors python.org and cwi.nl.
I have (almost) finished a Python interface to Netscape 2.0 using
the Netscape Plugin API. This API enables Netscape 2.0 to be extended
with additional functionality using a DLL. So now you can use Netscape
to run Python programs located at remote sites. The main components are:
1) A Python interface to the Netscape API. So you can access
this API from Python without writing C.
2) Two DLLs, npwpy31.dll for Windows 3.1x and npwpynt.dll for NT.
You just put this in the "plugins" directory of Netscape.
3) Three demo programs demo_ns1.py, demo_ns2.py and demo_ns.htm.
4) Documentation netscape.txt and plugin.htm.
5) Complete source including project files in wpyntsrc.exe.
To run a Python program, just open the Python program URL, for example,
demo_ns1.py or demo_ns2.py. To run in embedded mode, open a URL which
has an EMBED tag, such as demo_ns.htm.
Credits
=======
This work is based on the original Netscape plugin demonstrated at
the last Python workshop by Tyler Brook. He also helped me with
this version and provided critical insight.
ToDo - Help Needed!
===================
The current version requires the Python libraries to be present on the
system running Netscape if you use any "import" statements. You may
want to use the Netscape API method NPN_GetURL() to bring over the
required Python library files. Or do something imaginative with
imp.py.
The DLL prints a warning that it is running in insecure mode. Someone
may want to add rexec capability, or to provide some other way to get
security (at least one PhD thesis lurking here).
There is a problem with the 16-bit Windows 3.1 DLL. It is not possible
to create CEdit controls for some reason I have yet to find, and the
program will GPF if you try. This happens with the menu commands which
put up dialog boxes in demo_ns2. It doesn't happen on NT and so it is
tricky to find. You need the source tree wpyntsrc.exe and a compiler
to find the problem.
Jim Ahlstrom
|