Tuesday 17 October 2017

sleep - Windows 7 : Prevent computer from sleeping while there is network traffic

I have a python script that is downloading data on a remote computer. I want to prevent the computer from going to sleep as long as the data download is in progress. However if the program finishes/hangs/crashes, I want the computer to go to sleep.


I do not want to disable hibernation settings on my computer. I've looked around at programs like insomnia & command line shortcuts ( How can I put the computer to sleep from Command Prompt/Run menu? ) but they aren't perfect for the job. Any way I can put a try:except:finally block around my python code and call some function to put the computer to sleep ?


Update : Found this answer useful : What is the command to use to put your computer to sleep (not hibernate)? . I created a little one line sleep app that I can call from my python finally block using os.system call.

No comments:

Post a Comment

Where does Skype save my contact's avatars in Linux?

I'm using Skype on Linux. Where can I find images cached by skype of my contact's avatars? Answer I wanted to get those Skype avat...