Error: (2, ‘RegOpenKeyEx’, error resolution

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: