I'm trying to use SetThreadExecutionState to not allow windows to hibernate or go idle which reaks havoc with my program which runs for a long period of time with no data being entered but at times is suddenly called to action... I found this code and I want to us it but ... first I don't completely understand ctypes or kernel32.dll ... I keep getting this error and How would I turn this into a safe thread ?
ValueError: Procedure called with not enough arguments (4 bytes missing) or wrong calling convention
File "C:\Python26\sign\windowsnosleep.py", line 40, in <module>
File "C:\Python26\sign\windowsnosleep.py", line 33, in main
I don't understand the error and there is not alot of python information on this topic ... anyone have any ideas ?
ES_SYSTEM_REQUIRED = 0x00000001
ES_CONTINUOUS = 0x80000000
event = threading.Event()
def ctrlc(signum, frame) :
Prevent system suspend when idle
kernel32 = ctypes.CDLL('kernel32.dll')
if __name__ == '__main__' :