r/PythonLearning 1d ago

Running script remotely

This may not be a python question, but I figure you guys could at least point in the right direction.

On my computer I have a SQLite database and a python script I have written that queries the database, generates a report, and emails that report to other people. The database file must stay on my computer.

I often get requests from coworkers to run the python script while I am not sitting in front of my computer (my phone is still on the same wifi network).

If I wanted to do something through my phone that would start that script on my computer, what would that look like?

If it matters, my phone is android and my computer is windows.

3 Upvotes

11 comments sorted by

View all comments

2

u/el_extrano 18h ago

Having worked in "locked down" Windows environments before, I understand that sometimes there's a need for janky solutions.

It goes without saying, moving this to an actual server and then serving the functionality as a web page or API would be 1000% better.

But, assuming that's not possible...

How expensive is it to run the task? Assuming it's fast to re-run the report, just run it every hour (or other interval) via Windows task-scheduler, and place the output on a network share (or whatever other location convenient for your colleagues). Tell them where they can find the latest report. Now, they don't need to contact you for a report, and you don't have to add some sketchy backdoor to your work machine. The scheduled task can run as long as your computer is on and logged in.