Domanda

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.

È stato utile?

Soluzione

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

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top