This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Registry writes on Windows Store - workaround
Type: enhancement Stage:
Components: Windows Versions: Python 3.8
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: DataGhost, paul.moore, steve.dower, tim.golden, zach.ware
Priority: normal Keywords:

Created on 2020-07-01 00:40 by DataGhost, last changed 2022-04-11 14:59 by admin.

Messages (1)
msg372726 - (view) Author: (DataGhost) Date: 2020-07-01 00:40
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.
History
Date User Action Args
2022-04-11 14:59:33adminsetgithub: 85350
2020-07-01 00:40:23DataGhostcreate