简体   繁体   English

我不能在 python 中使用 Schedule

[英]I cant use Schedule in python

In the schedule docs, i copy the same function在计划文档中,我复制了相同的 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:如果您将其命名为schedule.py ,请考虑将其更改为另一个文件名,例如:

python3 scheduling_app.py

And not:并不是:

python3 schedule.py

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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