[Python-Dev] Windows registry path not ignored with Py_IgnoreEnvironmentFlag set

Kristján Valur Jónsson kristjan at ccpgames.com
Sat Jun 5 20:05:07 CEST 2010


Tangengially relevant is the following:  When embedding python, it is currently impossible (well, in 2.x anyway) to completely override pythons magic path-guessing algorithm.  This is annoying.  Last pycon, the talk on embedding python, showed how applications that do that often get started through bootstrapping batch scripts that set up the environment for python, to guide the path-setting algorithm along.

At CCP, we have patched python so that we can specify an initial sys.path, and completely disable the path guessing algorithm.  This is necessary because python is _embedded_ and it is the embedding application that knows where it is allowed to look for libraries.  This is in addition to telling it to ignore the environment.

In fact, it is my opinion that the path init stuff, as well as command line parsing and so on, really belongs in python.exe and not in python25.lib, although one can argue for the convenience of keeping it in the .lib.  But IMHO, it should not be part of Py_Initialize.

Perhaps I'll submit this particular patch to the tracker one day.

K

> -----Original Message-----
> From: python-dev-bounces+kristjan=ccpgames.com at python.org
> [mailto:python-dev-bounces+kristjan=ccpgames.com at python.org] On Behalf
> Of Guido van Rossum
> Sent: 5. júní 2010 14:55
> To: Mark Hammond
> Cc: Python-Dev
> Subject: Re: [Python-Dev] Windows registry path not ignored with
> Py_IgnoreEnvironmentFlag set
> 
> I don't object (this had never occurred to me), but is Python on
> Windows fully functioning when the registry is entirely ignored?
> 
> --
> --Guido van Rossum (python.org/~guido)



More information about the Python-Dev mailing list