[New-bugs-announce] [issue41178] Registry writes on Windows Store - workaround

DataGhost report at bugs.python.org
Tue Jun 30 20:40:23 EDT 2020

New submission from DataGhost <site.pythonbugs at dataghost.com>:

I just installed the Windows Store version of Python (v3.8.3:6f8c832) on Windows 10.0.18362.900 (1903, old VM) and quickly ran into the issue that registry writes aren't visible system-wide. I later found a remark about this in the Known Issues section of the Using Python on Windows page. Real-world scenario: running "python -m pip install --user pipx" and subsequently "python -m pipx ensurepath" says it changed the PATH variable, but it does not take effect even after a reboot. I'd say this is one of the cases where a user might not know about what's going on and why it fails, even after reading the known issues, and the developer might not have thought of the existence or incompatibility of the Windows Store version of Python at all.

I have found a workaround to do this, though, and I figured the best place to do that is in the actual winreg module so that users and developers don't need to worry about this. Calling reg.exe allows registry variables to be written in the "normal" registry, and these changes are system-wide rather than in the private copy Store apps use. Some functions could be changed to use the reg.exe binary instead of the system calls on Windows Store builds. Other functions, such as for querying, don't need any changes.

I realise this is an ugly workaround so I'm just suggesting it in hopes of improving compatibility, so that users and developers don't need to worry about these issues anymore. I did some basic tests on this, by executing reg.exe through the subprocess module, and testing for a Windows Store instance by checking sys.base_exec_prefix. There are probably better ways but at least this shows that it should be possible in just Python.

components: Windows
messages: 372726
nosy: DataGhost, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Registry writes on Windows Store - workaround
type: enhancement
versions: Python 3.8

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list