Deploying embedded Python

A

Andreas Raab

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? How does
one work around/remove those dependencies? Is there any information
available about how exactly the startup works? What is being read/loaded
in which order etc?

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

Thanks,
- Andreas
 
G

Graham Dumpleton

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
 
A

Andreas Raab

Graham said:
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.

Aha! I have never seen this call mentioned in any of the embedding docs.
Yes, the source code. :)

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

Thanks I'll do that.

Cheers,
- Andreas
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,772
Messages
2,569,593
Members
45,111
Latest member
KetoBurn
Top