Embedding Python in Windows App , use of Registry & ENV to find modules

Mark Hammond mhammond at skippinet.com.au
Fri Dec 6 01:51:53 EST 2002


quadric at primenet.com wrote:
> The machines that this Windows App run on may or may not have full 
> installations of Python
> on them at the time of installation of Windows App, or may have full 
> installation of Python applied
> after installation of Windows App.  In any case, I would like to 
> safeguard the Windows App from
> Python version conflicts by isolating all required Python 
> DLL's/EXE's/pyc's etc.... into a location
> I can control and keep separate from any other Python installations.

The simplest way may be to open the pre-built Python2x.dll in MSVC (as a 
"resource", not as "auto", and change the single string resource from 
the "2.x" it will be.  This will then become sys.winver, and is used to 
form the keyname Python used.  You can change this to "foo", and have 
Python look in HKLM\Software\Python\foo for all its settings.  Thus, 
your personal Python should not conflict with any others (assuming you 
keep all Python files local to your application)

Or, as already suggested, just explicity set sys.path and/or PYTHONPATH 
appropriately.  The "Registered Module" concept is going away, and isn't 
used by anyone I know of.

Mark.




More information about the Python-list mailing list