schedule在这个脚本中不起作用。schedule该脚本sudo python3 "the script file"没有 . 任何人都知道为什么以及如何解决它?import Adafruit_DHTimport requestsimport scheduleimport timesensor = Adafruit_DHT.DHT22pin = 2humidity, temperature = Adafruit_DHT.read_retry(sensor, pin)def jobb(): print('Kjører script...') if humidity is not None and temperature is not None: print('Temperature ={0:0.1f}*C Humidity = {1:0.1f}%'.format(temperature, humidity)) payload = {'temp': temperature, 'hum': humidity} r = requests.post('http://192.168.1.7/test/MySQL_POST_Test.php, data=payload') print(r.text) else: print('Failed to read the sensor, try "sudo python3 sensor-post.py" again.')schedule.every().day.at("00.00").do(jobb)schedule.every().day.at("02.00").do(jobb)schedule.every().day.at("04.00").do(jobb)schedule.every().day.at("06.00").do(jobb)schedule.every().day.at("08.00").do(jobb)schedule.every().day.at("10.00").do(jobb)schedule.every().day.at("12.00").do(jobb)schedule.every().day.at("14.00").do(jobb)schedule.every().day.at("16.00").do(jobb)schedule.every().day.at("18.00").do(jobb)schedule.every().day.at("20.00").do(jobb)schedule.every().day.at("22.00").do(jobb)while True: schedule.run_pending() time.sleep(1)如果您有任何问题,请提出,我会尽快回复。
添加回答
举报
0/150
提交
取消