如何将时间表与异步功能一起使用?

时间:2020-03-21 12:14:24

标签: python python-3.x discord.py discord.py-rewrite

当我尝试在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

0 个答案:

没有答案