Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/363.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 任务名称错误:名称';周期';未定义discord.py_Python_Discord.py Rewrite - Fatal编程技术网

Python 任务名称错误:名称';周期';未定义discord.py

Python 任务名称错误:名称';周期';未定义discord.py,python,discord.py-rewrite,Python,Discord.py Rewrite,自行车坏了。找不到一个简单的解决方案我对整体编码还不熟悉抱歉我的noob esh行为我希望有个答案tho 我的错误消息是: @tasks.loop(seconds=3600) async def change_status(): await client.change_presence(activity=discord.Game(next)) 回溯(最近一次呼叫最后一次): 文件“c:\Users\pc\OneDrive\Documents\3mbot\main code\mbot.p

自行车坏了。找不到一个简单的解决方案我对整体编码还不熟悉抱歉我的noob esh行为我希望有个答案tho

我的错误消息是:

@tasks.loop(seconds=3600)
async def change_status():
    await client.change_presence(activity=discord.Game(next))
回溯(最近一次呼叫最后一次):
文件“c:\Users\pc\OneDrive\Documents\3mbot\main code\mbot.py”,第20行,在
状态=周期(['status1','status2',
NameError:未定义名称“cycle”

循环在itertools模块中

Traceback (most recent call last):
  File "c:\Users\pc\OneDrive\Documents\3mbot\main code\mbot.py", line 20, in <module>
    status = cycle(['status1','status2',
NameError: name 'cycle' is not defined

来自itertools导入周期
是的,我没有想到。这是一个旧脚本。它似乎在4个月前就开始工作了。
@client.event
async def on_ready():
    change_status.start()
    print('Bot online')
@tasks.loop(seconds=3600)
async def change_status():
    await client.change_presence(activity=discord.Game(next))
Traceback (most recent call last):
  File "c:\Users\pc\OneDrive\Documents\3mbot\main code\mbot.py", line 20, in <module>
    status = cycle(['status1','status2',
NameError: name 'cycle' is not defined
from itertools import cycle