Questions tagged [winreg]

_winreg is the python module for Windows registry access. This module provides a low-level interface to the Windows registry database. The interface directly mirrors the underlying Windows API.

_winreg (renamed to winreg in Python 3) is the python module for Windows registry access. The functions in this module expose the Windows registry API to Python. Rather than using an integer as the registry handle, a handle object is used to ensure that the handles are closed correctly, even if the programmer neglects to explicitly close them.

For a complete reference, please see the python documentation at docs.python.org.

160 questions
23
votes
4 answers

importError: no module named _winreg python3

Where can I download _winreg for python3 if I can at all. I have my 'windir' on E:\Windows. I do not know if cx_Freeze did not notice that. I am using cx_Freeze to create an msi installer.
BantuCoder
  • 251
  • 1
  • 2
  • 8
22
votes
9 answers

python script to read and write a path to registry

I have developed a python script where i have a setting window which has the options to select the paths for the installation of software.When clicked on OK button of the setting window, i want to write all the selected paths to the registry and…
Aramanethota
  • 683
  • 2
  • 9
  • 23
12
votes
1 answer

How do I Open Windows Registry with write access in Python

I'm having some problems accessing the Windows 7 Registry with the _winreg.QueryValueEx function in the Python 2.7.3 _winreg module. I am running the python process as Administrator, and can create new keys and values like this: import _winreg as…
TrinitronX
  • 4,959
  • 3
  • 39
  • 66
11
votes
2 answers

Python _winreg woes

I'm trying to access the windows registry (in Python) to query a key value using _winreg and I can't get it to work. The following line returns a WindowsError saying that the "system cannot find the specified file": key =…
user1219144
  • 111
  • 1
  • 3
11
votes
5 answers

Loop through values or registry key.. _winreg Python

How would I loop through all the values of a Windows Registry Key using the Python module _winreg. I have code that will do what I want, but it is for the subkeys of the specified registry key. Here Is The Code: from _winreg import * t =…
Zac Brown
  • 5,905
  • 19
  • 59
  • 107
9
votes
1 answer

winreg.OpenKey throws filenotfound error for existing registry keys

I am facing difficulties in reading a registry key created by my software. However with the same code, I am able to read other keys. installdir = winreg.OpenKey( winreg.HKEY_LOCAL_MACHINE, …
Debianeese
  • 154
  • 1
  • 2
  • 9
9
votes
7 answers

Python winreg looping through sub-keys

I'm able to successfully retrieve the 5 sub-keys from my windows 7 machine registry hive "HKEY_LOCAL_MACHINE" with the code below. from _winreg import * try: i = 0 while True: subkey = EnumKey(HKEY_LOCAL_MACHINE, i) print…
user1982218
  • 91
  • 1
  • 1
  • 3
8
votes
1 answer

Python winreg module access denied

Here is my code: import winreg as wreg key = wreg.OpenKey(wreg.HKEY_LOCAL_MACHINE, r'SYSTEM\CurrentControlSet\Services\Tcpip\Parameters',wreg.KEY_ALL_ACCESS) wreg.SetValueEx(key,"IPEnableRouter", 0, wreg.REG_DWORD, 1) When i run this script, it…
hckn0
  • 137
  • 1
  • 2
  • 12
7
votes
2 answers

How do I add a python script to the startup registry?

I'm trying to make my python script run upon startup but I get the error message windowserror access denied, but I should be able to make programs start upon boot because teamviewer ( a third-party program I downloaded ) runs every time I restart my…
Baboon
  • 307
  • 3
  • 6
  • 14
7
votes
1 answer

Python _winreg key path incorrect

When I try reading a value from this key, the proper value of this key is not returned, but instead I get a different key path's value? import _winreg as wreg key = wreg.OpenKey(wreg.HKEY_LOCAL_MACHINE,…
user3818650
  • 581
  • 1
  • 7
  • 19
6
votes
5 answers

python: how to delete registry key (and subkeys) from HKLM (getting error 5)

I'm trying to delete certain registry keys, via python script. i have no problems reading and deleting keys from the "HKEY_CURRENT_USER", but trying to do the same from the "HKEY_LOCAL_MACHINE", gives me the dreaded WindowsError: [Error 5] Access is…
Tom Kidron
  • 177
  • 2
  • 2
  • 11
5
votes
3 answers

Deleting a Windows Registry Value with Python

I would like to delete values from the registry in Windows using Python, but I don't understand what is the sub_key in the python documentation: I have the following code, which I would like to use: def del_env(name): key =…
oz123
  • 27,559
  • 27
  • 125
  • 187
5
votes
2 answers

Buildozer doesn't work with java under cygwin

I'm trying to buildozer android debug deploy in my cygwin environment. So far it worked quite well, but upon trying to build, I run into the following error: $ buildozer android debug deploy # Check configuration tokens # Ensure build layout # Check…
plocks
  • 561
  • 8
  • 25
5
votes
2 answers

Python: WindowsError when editing Registry values using _winreg on Windows 7

I am trying to execute this script by Ned Batchelder to switch .py file association between my two Python installations on Windows. This Python script uses the _winreg module (winreg in Python 3.x) to edit certain Registry values (the path and value…
Ashwin Nanjappa
  • 76,204
  • 83
  • 211
  • 292
4
votes
1 answer

Is the name of winreg module name is different in pip install?

How can i install winreg module? When I try this pip install winreg It gives me this error: Could not find a version that satisfies the requirement winreg (from versions:) No matching distribution found for winreg Is the name of winreg module…
Wyren
  • 117
  • 1
  • 4
  • 16
1
2 3
10 11