Thursday 15 May 2014

python - the system was unable to find the specified registry key -



python - the system was unable to find the specified registry key -

i run dos command:

reg query hklm\software\classes\clsid\{824293fd-32e2-4daa-bc28-166c140543be}\inprocserver32 /ve

and successfullly value. in same terminal, when utilize python below:

cmd = "reg query hklm\\software\\classes\\clsid\\{824293fd-32e2-4daa-bc28-166c140543be}\\inprocserver32 /ve" proc = subprocess.popen(cmd, shell=true, stdout=subprocess.pipe) output = proc.communicate()[0]

it fails error:

error: scheme unable find specified registry key or value.

i'm using same terminal opened admin. tried puting in x.bat file , called x.bat in python subprocess...still same error. reg key has read permission users , total command admin. happening on windows server 2008r2 python 2.7.

also i've had no luck _winreg ideas how solve problem running batch command within python?

to create clear: works in dos terminal, fails in python!

moreover, tried key:

reg query hklm\software\classes\xml

and 1 works. 1 thing i've noticed key has problem has read permission checked , disabled while latter key has read permission checked , enabled (can changed).

i realized i've seen problem before... solution: disabling wow64 redirect

change reg %windir%/sysnative/reg.exe

cmd = "%windir%/sysnative/reg.exe query hklm\\software\\classes\\clsid\\{824293fd-32e2-4daa-bc28-166c140543be}\\inprocserver32 /ve" proc = subprocess.popen(cmd, shell=true, stdout=subprocess.pipe) output = proc.communicate()[0]

what's more, managed _winreg:

import _winreg key = _winreg.openkey(_winreg.hkey_local_machine, r'software\classes\clsid\{824293fd-32e2-4daa-bc28-166c140543be}\inprocserver32', 0, _winreg.key_wow64_64key + _winreg.key_all_access) print _winreg.queryvalueex(key, "")

python

No comments:

Post a Comment