简体   繁体   中英

I cant use Schedule in python

In the schedule docs, i copy the same function

import schedule
import time

def job():
    print("I'm working...")

schedule.every(10).seconds.do(job)

while True:
    schedule.run_pending()
    time.sleep(1)

but it isnt working

    schedule.every().seconds.do(job)
    ^^^^^^^^^^^^^^
AttributeError: partially initialized module 'schedule' has no attribute 'every' (most likely due to a circular import)

What did you name your source code file? If you named it schedule.py , please consider changing it to another filename like:

python3 scheduling_app.py

And not:

python3 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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM