The task I need to do is to write some python codes to make computer can execute another python code which is provided by my colleague at 8 am every day. (The codes he provide me could be used to automatically download something from the internet or processing some excel sheets)
Actually, I have already found a previous post in StackOverflow which could very match what I want: Python script to do something at the same time every day
However, I am a python beginner, so I don't know what is the "exact / practical" way to execute these codes. My questions could stupid but hope someone still can help me.
Let me describe my problems below...
Scenario Background:
Each day, My colleague will push ctrl+L to lock his computer (not log off or shut down) before leaving the office and the computer will go into sleep mode in the final. He will come to the office at around 9 am, but he hopes my python code can automatically execute some of his python codes at 8 am each day.
The final result should be like this:
- Automatically wake up the computer (I think this step can be done by windows setting, instead of using python. Would it be easier?)
- Even the computer is still locked, my python code should still automatically execute another python code at 8 am.
So my codes are as follow (Based on that previous post in StackOverflow):
from datetime import datetime
from threading import Timer
x=datetime.today()
y=x.replace(day=x.day+1, hour=8, minute=0, second=0)
delta_t=y-x
secs=delta_t.seconds+1
def daily_task():
# Put my Colleague's codes here
t = Timer(secs, daily_task)
t.start()
My real question is:
I write these codes in Spyder (This is the only environment I know how to use...) Should I just press F5 and execute all my codes and then it's done?
Or should I run these codes on cmd or something like that?
Will my codes still work after I close down my Spyder?
If my code will still work after I close Spyder, then what is the exact way to stop my code?
Sorry, I know my question could be very stupid or even ask the wrong questions.
But I usually only use python to do some very simple data processing and analysis, and never use it to do such a practical thing. So I totally have no idea how to do it even though I have already googled it.