[capi-sig] Deploying embedded Python

Jon Parise jon at csh.rit.edu
Thu Jan 3 08:18:08 CET 2008


On Fri, Dec 21, 2007 at 01:30:35AM -0600, Jeff Rush wrote:

> > 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?
> 
> If you are picking up stray installations it is probably through the
> PYTHONPATH environment variable.  For a brief understanding of these, run the
> command "python --help".  For your embedded world, you ought to change your
> distributed code to use a different environment variable, maybe a prefix or
> suffix.
 
You can also set the Py_IgnoreEnvironmentFlag to 0 before calling
Py_Initialize().  This is the equivalent of running python with the -E
command line option:

    -E     : ignore environment variables (such as PYTHONPATH)

-- 
Jon Parise (jon of csh.rit.edu)  ::  "Scientia potentia est"


More information about the capi-sig mailing list