簡體   English   中英

Python計划腳本在IDLE中運行,但不在Visual Studio Code中運行

[英]Python schedule script running in IDLE but not in Visual Studio Code

以下測試代碼可以在Python IDLE中完美運行,但是在Visual Studio Code中,我收到一條錯誤消息,內容為:

“ AttributeError:'模塊'對象沒有屬性'每個'...”

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  

我正在嘗試安排Python中的重復任務。 我已經安裝了schedule模塊,並使用代碼進行了試用。 清理文件,重命名文件並將其重新寫入新文件並沒有幫助。

腳本怎么可能在一個應用程序中運行而不在另一個應用程序中運行? 那有意義嗎?

任何幫助將不勝感激。 提前致謝。

你可以做:

from schedule import * 
import schedule

打印:

print schedule.__file__ 

另外,請確保您的文件名未命名為:“ schedule.py”

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM