Question

import _winreg as wreg
key = wreg.CreateKey(wreg.HKEY_LOCAL_MACHINE, "Software\\testfolder")

I can't seem to make this code work without admin permissions. Is there something I need to add to my code to make this work? Or is the best way to go about this, prompting for admin permissions? If so, how do I get Windows to generate that prompt?

Thanks so much.

Was it helpful?

Solution

key = wreg.CreateKey(wreg.HKEY_CURRENT_USER, "Software\\testfolder")

I think you can do ... if you need to write to a keyspace that requires admin(eg. LOCAL_MACHINE) you will need to elevate permissions

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top