[Python-Dev] Python environment registration in the Windows Registry
Steve Dower
steve.dower at python.org
Wed Feb 3 12:53:41 EST 2016
On 03Feb2016 0923, eryk sun wrote:
> On Wed, Feb 3, 2016 at 10:46 AM, Steve Dower <steve.dower at python.org> wrote:
>>
>> sys.path.extend(read_subkeys(fr'HKCU\Software\Python\PythonCore\{sys.winver}\PythonPath\**'))
>> sys.path.extend(read_subkeys(fr'HKLM\Software\Python\PythonCore\{sys.winver}\PythonPath\**'))
>
> It seems like a bug (in spirit at least) that this step isn't skipped
> for -E and -I (Py_IgnoreEnvironmentFlag, Py_IsolatedFlag).
They should be skipped. If not, I'm very much in favour of fixing that
immediately in all active branches.
>> I haven't looked into pywin32's use of this recently - I tend to only use
>> Christoph Gohlke's wheels that don't register anything.
>
> I install the pypiwin32 wheel using pip, which uses pypiwin32.pth:
>
> # .pth file for the PyWin32 extensions
> win32
> win32\lib
> Pythonwin
>
> import os;os.environ["PATH"]+=(';'+os.path.join(sitedir,"pypiwin32_system32"))
>
> This is different from a PythonPath subkey in a couple of respects.
> The paths listed in .pth files are appended to sys.path instead of
> prepended. They also don't get added when run with -S or for a venv
> environment that excludes site-packages.
Yeah, there are serious problems with doing these kinds of hacks in .pth
files. However, this is not directly affected by the registry, so
thankfully not a concern right now.
Cheers,
Steve
More information about the Python-Dev
mailing list