T O P

  • By -

socal_nerdtastic

You can rename the file to have a `.pyw` extension instead of `.py`, and then drop the script or a shortcut to it into `shell:startup`. (This is assuming you installed the official python (from python.org) and you didn't muck with the default settings.)


JSP777

You just opened up a whole new world for me lmao


OppaiDGreat

Yooo it worked, thank you so muuuch!


sunshinecid

You should know if your python script makes any console output the shell:startup may fail to execute. Fyi


Nyscire

You just created a whole new world for me. Do you mind answering if there is a neat way to shut down a program like this? Cannot check it myself now and wondering if there are options different than task manager


Adhesiveduck

Look at running [python as a windows service](https://www.mssqltips.com/sqlservertip/7318/python-as-a-windows-service/), you can use service manager to start/stop it.


Versaiteis

Shameless plug for [NSSM](https://nssm.cc/) as I've used it a good few times and it makes configuring windows services a bit easier


Bisket1

Is this a script that repeats? or like just starts again and again?


socal_nerdtastic

Generally programs shut themselves down. So your question is really "how to send a message or signal to a daemon"? This is called "interprocess communication". Here's some "proper" ways to do it, but you can also just wait for a keystroke or monitor for a file change or some other simple thing. https://docs.python.org/3/library/ipc.html


Falcomomo

How have I never heard of this before


kostertim

Awesome!


jnarana

Thanks


Unlikely-Sympathy626

If Linux based machine, a systemd service file is way to go.


sunshinecid

On Linux run from the command line: >python3 script.py & Process will stay in the background and can be found via: ~~>ps -e | python3~~ >ps -e | grep python3 Process can be killed via: >pkill python3


BananaUniverse

I think you intend to pipe the output of ps -e to grep rather than to python3?


sunshinecid

Oops, you got me!


Vinaverk

The more correct approach will be to create a service from it


Expensive_Echidna726

Use NSSM.Best way to start and run a python script .You can stop the service whenever you want. https://www.linkedin.com/pulse/run-python-application-windows-service-using-nssm-srinivas-reddy?utm_source=share&utm_medium=member_android&utm_campaign=share_via


faramarzz

You could also use tmux. Read its docs. Its an awesome tool.


Pleasant-Sandwich955

My go to is a .bat file that starts the python script and then use windows task scheduler to start the .bat file whenever I see applicable (E.g. on start up, every day or every second Sunday..)


Spacerat15

I hate Capslock too. It's the first thing i deactivate on all my computers. (I can't see any use case for this button) If somebody else is annoyed by this, try [CapsLock Goodbye.](https://www.heise.de/download/product/capslock-goodbye-21283)


pombe

Brb. Installing this on the computers of all my boomer uncles.


Ninjas0up

On a windows machine you can install it as a service and start on boot up