I need Python event that should log present time into a file when windows receive sleep request. Below is my main code,
import subprocess
# Here code required to log the time at which system going to sleep
command = 'Sleep.py'
# Some usefull stuff
if subprocess.call(command, shell=True):
print 'Success'
else:
print 'Fail'
Below is 'Sleep.py' code,
import os
os.system("Rundll32.exe Powrprof.dll,SetSuspendState Sleep")
Can any one please provide solution to this