The following test code runs perfectly in Python IDLE but in Visual Studio Code I get an error message that says:
"AttributeError: 'module' object has no attribute 'every' ..."
import schedule
import time
def job(t):
print "I'm working..." , t
return
schedule.every().day.at("08:16").do(job,'hello')
while True:
schedule.run_pending()
time.sleep(60) # wait one minute
I am trying to schedule a recurring task in Python. I've installed the schedule module and used the code to try it out. Cleaning chache, renaming the file and re-writing it in a new file didn´t help.
How is it possible that a script runs in one application and not in the other?? Does that make sense?
Any help would be greatly appreciated. Thanks in advance.
Can you do:
from schedule import *
import schedule
Print:
print schedule.__file__
Also Be sure your file name, is not named: "schedule.py"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.