winreg

python: _winreg problem

可紊 提交于 2019-12-01 00:40:11
the windows registry may contain keys whose names with embedded nulls when i call _winreg.OpenKey(key, subkey_string_with_embbeded_null) i get the following error: TypeError: OpenKey() argument 2 must be string without null bytes or None, not str Q1: is the meaning of the error that python _winreg module has a limitation that it cannot open keys whose names have embbeded nulls? Q2: how do i get around this limitation? Q1: right. Q2: download and install win32all . 来源: https://stackoverflow.com/questions/2384064/python-winreg-problem

How do I Open Windows Registry with write access in Python

烂漫一生 提交于 2019-11-27 18:52:44
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 wreg key = wreg.CreateKey(wreg.HKEY_LOCAL_MACHINE, "Software\\TestCompany\\TestProject") # Create new subkey wreg.SetValue(key, 'NewSubkey', wreg.REG_SZ, 'testsubkey') print wreg.QueryValue(key, 'NewSubKey') # prints 'testsubkey' # Create new value wreg.SetValueEx(key, 'ValueName', 0, wreg.REG_SZ, 'testvalue') print wreg.QueryValueEx(key,'ValueName')

Unable to import _winreg in Python 2.7.9 virtual environment

社会主义新天地 提交于 2019-11-27 07:18:32
问题 I'm running an app engine application in a virtual environment on windows 7 64bit, python 2.7.9 x64. Here's the stacktrace: p_system = platform.system() File "C:\Python27\lib\platform.py", line 1310, in system return uname()[0] File "C:\Python27\lib\platform.py", line 1206, in uname release,version,csd,ptype = win32_ver() File "C:\Python27\lib\platform.py", line 597, in win32_ver import _winreg File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\devappserver2\python

How do I Open Windows Registry with write access in Python

假装没事ソ 提交于 2019-11-26 19:31:55
问题 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 wreg key = wreg.CreateKey(wreg.HKEY_LOCAL_MACHINE, "Software\\TestCompany\\TestProject") # Create new subkey wreg.SetValue(key, 'NewSubkey', wreg.REG_SZ, 'testsubkey') print wreg.QueryValue(key, 'NewSubKey') # prints 'testsubkey' # Create new value