From: gmcm at hypernet.com (Gordon McMillan)
Date: Thu, 22 Apr 1999 22:06:26 GMT
Subject: Embedding Python - Win32 - Request for Info/Opinions
In-Reply-To: <371f32af.0@news.inet-systems.net>
References: <371f32af.0@news.inet-systems.net>
Message-ID: <1287303503-36876650@hypernet.com>
Content-Length: 2253
X-UID: 565                                                  

Frank McGeough writes:
> 
> I've gotten Python to embed in a Win32 COM dll. (It's very simple,
> thanks to everyone that worked on the PCBuild stuff). I wanted to
> ask a couple of general questions because I'm curious about how I
> can use this in an actual app.
> 
> What do I need to install when I put this on a target machine? I
> start off with creating a Python directory.  If I put my COM dll,
> atl.dll and the python15.dll in this directory I can get my wrapper
> to register...but do I need to set PythonPath? do I need to install
> common py files? Where would I put these? Do I just mirror (in a
> very small way) what the Python install does? What is commonly done
> by people who are using Python commercially?

You can take complete control by providing exceptions.py and a 
site.py in the app's current directory. Use site.py to force whatever 
twisted perverted setup you desire. See 
 http://www.mcmillan-inc.com/install.html

> If I want to use win32com stuff what else do I need to install?

The above package has something that will determine all your
dependencies, both scripts and (since you have MSVC), binary.

For COM servers, COM needs to be able to find your stuff. That used 
to mean installing on the PATH somewhere, but I think build 124 
of Mark's stuff fixes that.

> Is the Python interpreter thread-safe? In what I've done so far I've
> got an in-proc dll marked as free-threaded.

This should work fine. Python is thread safe for Python-created 
threads. Getting it to work with C-created threads is do-able, but a 
headache.

> I have a com object that
> wraps the Python interpreter and lets me pass files or strings into
> the interpreter. What I want is to instantiate this COM object from
> different threads and have those threads run scripts. Is this going
> to work? What have people done to achieve the same kind of
> functionality? That is, use Python in a server environment and get
> lots of different scripts executing at the same time. 

We've seen postings from people working towards this same idea, but 
I've never been clear on why you'd run have one process executing a 
bunch of independent scripts. It's a lot less work and not much more 
load on the OS to run separate processes.


- Gordon




