Embedded Tcl for Python

Robin Becker robin at jessikat.demon.co.uk
Mon Jun 28 12:46:51 EDT 1999

In article <37776F4E.6113 at mailserver.hursley.ibm.com>, Paul Duffin
<pduffin at mailserver.hursley.ibm.com> writes
>Robin Becker wrote:
>> Paul I created a socket linked python interpreter and have used it with
>> reasonable success from Tcl. Latest code is at
>> http://www.jessikat.demon.co.uk in the file pyserver.zip
>> this may not be as efficient as havin the in core thing, but gets round
>> the problem of threading model problems etc.
>Thanks Robin, I will take a look at that, have you got any information
>on the threading model problems as I have not yet looked into Python
>threading. I must admit I was amazed that Python does not support
>being built as a shared library and can think of no practical reason why
>not as Python does support dynamically loadable extensions.
The python15 dll/so is usable directly by other c programs; I was just
too new to python internals to attempt the creation of a python
interpreter object for use by tcl. Using the socket interface allows the
standard python interpreter to handle all the textual commands directly
and also decouples the two script interpreters.

As I understand it python is not multithreaded out of the box. Python
has it's own form of 'threads' to avoid a large per thread data set. tcl
8.0.x isn't multi-threaded so to achieve my target of having event
driven i/o for my http server + a long running calculation (in python) I
used tclHTTPD + a socket interface to the python cpu hog. The result is
similar to having a proper multithread thing.
>Have any Pythoneers out there done this as it is very useful ?
>If you have any questions as to how useful it is you just need to look
>at Tkinter which could not be dynamically loadable (it is isn't it)
>without Tcl and Tk being dynamically loadable.

Robin Becker

More information about the Python-list mailing list