मुझे अपने सॉफ़्टवेयर द्वारा बनाई गई रजिस्ट्री कुंजी पढ़ने में कठिनाइयों का सामना करना पड़ रहा है। हालांकि एक ही कोड के साथ, मैं अन्य चाबियाँ पढ़ने में सक्षम हूं।winreg.OpenKey मौजूदा रजिस्ट्री कुंजियों के लिए filenotfound त्रुटि फेंकता है
installdir = winreg.OpenKey(
winreg.HKEY_LOCAL_MACHINE,
"SOFTWARE\\Microsoft\\MediaPlayer\\Player\\Extensions\\Types"
) #this works perfect
#installdir1 = winreg.OpenKey(
winreg.HKEY_LOCAL_MACHINE,
"SOFTWARE\\MySoftware\\MyEvent\\IS"
) #this gives Filenotfound error
# list values owned by this registry key
try:
i = 0
while 1:
name, value, type = winreg.EnumValue(installdir, i)
print (repr(name))
i += 1
except WindowsError:
print ("Bot donf")
value, type = winreg.QueryValueEx(installdir, "10")
print("user is", repr(value))
value, type = winreg.QueryValueEx(winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, "SOFTWARE\\MySoftware\\MyEvent\\IS"), "v2")
print("user is", repr(value))
Traceback से पता चलता
Traceback (most recent call last):
File "D:/python_scripts/myclass.py", line 32, in <module>
value, type = winreg.QueryValueEx(winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, "SOFTWARE\\MySoftware\\MyEvent\\IS"), "v2")
FileNotFoundError: [WinError 2] The system cannot find the file specified
हालांकि विंडोज reg क्वेरी मूल्य सेट को पुनः प्राप्त करने में सक्षम है।
#reg query HKLM\SOFTWARE\MySoftware\MyEvent\IS /v v2
HKEY_LOCAL_MACHINE\SOFTWARE\MySoftware\MyEvent\IS
v2 REG_DWORD 0x12
किसी भी मदद अत्यधिक
रीक क्वेरी कथन में टाइपो संपादित किया गया। लेकिन किसी भी तरह की समस्या नहीं होनी चाहिए – Debianeese