Discord bot 在其运行时开始返回 unicode 错误消息

Discord bot started returning unicode error messages in the middle of its runtime

我的 discord bot 运行 完全没问题,但在运行过程中,没有重新启动,也没有更改任何文件。在它停止工作前不到一分钟,我们使用了它的命令,但突然之间,它停止响应我们向它发出的任何命令。当我停止任务管理器中的 python 进程和 Atom 的 运行 机器人时,每当我们发送任何消息时它都会给我这个错误消息:return codecs.charmap_decode(input,self.errors,decoding_table)[0] UnicodeDecodeError: 'charmap' codec can't decode byte 0x8d in position 79: character maps to <undefined>

我完全无法理解这条错误信息,这是什么意思?有办法解决吗?为什么它突然开始出现在它运行的中间?

一些附加信息:发生错误的行是:if open("totpal_guilds/" + message.guild.name + ".pkl", "r").read() == open("totpal_guilds/kort_dummy.pkl", "r").read(): 实际上,发送它抛给我的整个错误消息可能会有所帮助:

Ignoring exception in on_message
Traceback (most recent call last):
  File "C:\Users\capta\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py", line 343, in _run_event
    await coro(*args, **kwargs)
  File "C:\Users\capta\OneDrive\Documents\Programming\discord bots\Kort async\kort_as.pyw", line 117, in on_message
    if open("totpal_guilds/" + message.guild.name + ".pkl", "r").read() == open("totpal_guilds/kort_dummy.pkl", "r").read():
  File "C:\Users\capta\AppData\Local\Programs\Python\Python39\lib\encodings\cp1252.py", line 23, in decode
    return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x8d in position 79: character maps to <undefined>

我现在注意到了我的代码中的错误,我没有注意到我在打开函数的调用中使用了“r”而不是“rb”。但是,据我所知,如果不选择最佳答案,就无法将问题标记为已解决,所以我自己回答这个问题,这样问题就不会再打扰任何人了。