Read the key values in the registry in Python as follows:
#coding:utf-8
import win32api, win32con
import os
key = win32api.RegOpenKeyEx(win32con.HKEY_CLASSES_ROOT, 'CLSID\\{01249E9F-88FF-45d5-82DB-A1BEE06E123C}\\Shell\Open\\Command', 0, win32con.KEY_READ)
keyValue = win32api.RegQueryValue(key, '')
print keyValue
Then run it with the following error:
Traceback (most recent call last): File "D:\users\Desktop\yunpanAuto.py", line 8, in <module> key = win32api.RegOpenKeyEx(win32con.HKEY_CLASSES_ROOT, 'CLSID\\{01249E9F-88FF-45d5-82DB-A1BEE06E123C}\\Shell\Open\\Command', 0, win32con.KEY_READ) error: (2, 'RegOpenKeyEx', '\xcf\xb5\xcd\xb3\xd5\xd2\xb2\xbb\xb5\xbd\xd6\xb8\xb6\xa8\xb5\xc4\xce\xc4\xbc\xfe\xa1\xa3')
This depends on my own problem, because my Window system is 64-bit and Python is 32-bit, so I need to add another parameter:
key = win32api.RegOpenKeyEx(win32con.HKEY_CLASSES_ROOT, 'CLSID\\{01249E9F-88FF-45d5-82DB-A1BEE06E123C}\\Shell\Open\\Command', 0, win32con.KEY_READ | win32con.KEY_WOW64_64KEY)
Just change the statement after the key above.
Read More:
- RegOpenKeyEx returns error value 5
- tftp open error resolution
- Python about typeerror: required argument ‘mat’ (POS 2) not found error resolution
- Apple mach-o linker (ID) error resolution
- [project SDK is not defined] error resolution
- [details] jar conflict resolution in Maven (personal test)
- ACPI BIOS error resolution
- Eslint error reporting and resolution
- npm error resolution
- Error resolution of unexpected token in JSON at position 0
- [PCL + QT + vs] no override found for ‘vtkrenderwindow’ error resolution
- SQLCODE=-551, SQLSTATE=42501 error resolution
- ZABBIX server startup error resolution
- Jedis exception resolution: noauth authentication required
- Cannot assign requested address error resolution
- cl.exe Error resolution of ‘failed with exit status 2
- Resolution of internal server error problem in diango project
- Uncaught typeerror: cannot set property ‘of null error resolution
- io.UnsupportedOperation : not writable exception resolution
- Error resolution by Ubuntu: aclocal-1.14 ‘is missing on your system