Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Keep Python script running after screen lock (Win. 7)

Tags:

python

windows

I am running a Python script that uses the requests library to get data from a service.

The script takes a while to finish and I am currently running it locally on my Windows 7 laptop. If I lock my screen and leave, will the script continue to run (for ~3 hours) without Windows disconnecting from the internet or halting any processes? The power settings are already set up to keep the laptop from sleeping.

If it will eventually halt anything, how do I keep this from happening? Thanks.

like image 253
andrew Avatar asked Aug 06 '15 21:08

andrew


People also ask

Does python run while computer is locked?

You don't need to worry about the screen locking or turning off as these wont affect running processes. However, if your system is set to sleep after a set amount of time you may need to change this to Never. Keep in mind there are separate settings depending on whether or not the system is plugged in.

How do I keep a python program running forever?

Challenge: Run a piece of Python code forever—until it is forcefully interrupted by the user. Solution: use a while loop with a Boolean expression that always evaluates to True . Examples: have a look at the following variants of an infinite while loop.

Do python scripts run when computer is asleep?

Show activity on this post. Yes, terminal processes like a python script will stop execution when the machine goes into idle sleep.

Does code run when computer is locked?

Yes, when the computer is in lock mode the program and you run any programs it will run, if it is in sleep mode, program will stop running.


1 Answers

As long as the computer doesn't get put to sleep, your process should continue to run.

like image 100
Jesse Webb Avatar answered Sep 24 '22 09:09

Jesse Webb