How to Constantly Run Python Script in the Background on Windows

Running Python Script as a Windows background process

On Windows, you can run a Python script in the background using the pythonw.exe executable, which will run your program with no visible process or way to interact with it. You also cannot terminate it without a system monitor. More information on pythonw.exe can be found in the answers to the question: pythonw.exe or python.exe?

How to start a python script in the background once it's run?

easy:

$ python yourpythonscript.py &

The os will handle that for you ;) Of course, you will have to state if this is on windows or *nix.

If you are running this under windows, you might want to check the cmd.exe program - I think there is an option there for running its arguments as a background process...

Or if you are running this under linux machine, you can check the process by using ps aux | grep yourpythonscript.py



Related Topics



Leave a reply



Submit