当我尝试在Python中安排异步函数时,出现错误。这就是我的代码的编写方式:
def Sheduling():
while True:
schedule.run_pending()
async def Asyncfunction():
#stuffs
ScheduleDaily= schedule.every().monday.do(Asyncfunction)
Thread = Thread(target=Sheduling, daemon=True)
Thread.start()
我能做什么?我收到该错误:
RuntimeWarning: coroutine 'Asyncfunction' was never awaited
self._run_job(job)
RuntimeWarning: Enable tracemalloc to get the object allocation traceback