Deploying embedded Python

Graham Dumpleton Graham.Dumpleton at gmail.com
Mon Dec 17 22:27:20 EST 2007


On Dec 18, 11:07 am, Andreas Raab <andreas.r... at gmx.de> wrote:
> Hi -
>
> I'm currently looking into a few deployment issues with our embedded
> Python interpreter and I'm looking for any information about deploying
> embedded Python that people may have. Specifically, I'm looking for the
> following information:
>
> 1) How to define a useful subset of the stdlib that can serve as an
> initial basis for the installation but later allows upgrade to the
> "full" library if desirable. In other words, I'd like to deploy a small
> subset of the stdlib to begin with (simply because of size constraints)
> which may later be extended to a full stdlib if this is desirable. Has
> someone done this before? I'd love to have a small "Python.zip"
> cross-platform stdlib surrogate that just gets shipped with the product.
> If not, what is the right starting point for analyzing the dependencies
> inside the stdlib?
>
> 2) How to isolate the embedded interpreter from environmental effects. I
> have found that on occasion, the interpreter would pick up "stray"
> installations which can cause weird problems. Which environmental
> settings affect the startup of an embedded Python interpreter?

PYTHONHOME environment variable, or if embedded in C application use
Py_SetPythonHome() before calling Py_Intialize(). This can be used to
ensure that specific Python installation is used as source of
configuration and modules.

> How does
> one work around/remove those dependencies? Is there any information
> available about how exactly the startup works?

Yes, the source code. :-)

> What is being read/loaded
> in which order etc?

Set PYTHONVERBOSE environment variable to have Python output a lot of
information about what it is doing at startup.

Graham

> 3) General advice about deploying embedded Python. Pointers to web
> sites, general experience (good or bad) etc. are all very welcome.
>
> Thanks,
>    - Andreas




More information about the Python-list mailing list