سؤال

I am trying to set a DWORD value of 0xFFFFFFFF in Windows registry. But when I try this:

_winreg.SetValueEx(aKey,"dword_test_2",0, _winreg.REG_DWORD, 4294967295L )

it throws an error:

ValueError: Could not convert the data to the specified type.

Please help..

هل كانت مفيدة؟

المحلول

In Python, using the L suffix to a number creates a value of type long. The long is an integer of arbitrary size. The DWORD likely corresponds to an int in Python.

Did you try

_winreg.SetValueEx(aKey,"dword_test_2",0, _winreg.REG_DWORD, 0xFFFFFFFF )

or

_winreg.SetValueEx(aKey,"dword_test_2",0, _winreg.REG_DWORD, -1 )

?

نصائح أخرى

Oh yeah, this. I think you need to use -1 instead.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top