Discord Bot上的循环功能不起作用

2024-05-19 01:40:12 发布

您现在位置:Python中文网/ 问答频道 /正文

每当我尝试使用这个循环功能时,它都会给我一个错误,该错误的行数超出了代码的末尾。一般来说,我对python和编码都是相当陌生的,但我认为这是我下载的存储库的一部分。错误代码如下所示

Traceback (most recent call last):
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/player.py", line 603, in run
    self._do_run()
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/player.py", line 590, in _do_run
    data = self.source.read()
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/player.py", line 543, in read
    ret = self.original.read()
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/player.py", line 228, in read
    ret = self._stdout.read(OpusEncoder.FRAME_SIZE)
AttributeError: 'NoneType' object has no attribute 'read'
 
During handling of the above exception, another exception occurred:
 
Traceback (most recent call last):
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/player.py", line 616, in _call_after
    self.after(error)
  File "main.py", line 242, in play_next_song
    raise VoiceError(str(error))
VoiceError: 'NoneType' object has no attribute 'read'

我的整个代码块是here。我正在尝试在repl.it中托管此discord bot,如果这与此有关的话

任何帮助都将不胜感激,谢谢


1条回答
网友
1楼 · 发布于 2024-05-19 01:40:12

stacktrace的相关部分实际上是最后一部分:

  File "main.py", line 242, in play_next_song
    raise VoiceError(str(error))
VoiceError: 'NoneType' object has no attribute 'read'

不能两次使用同一FFMPEGPCAudio对象。你有权创建一个新的

相关问题 更多 >

    热门问题