gpt4 book ai didi

python - 统一码编码错误 : 'UCS-2' codec can't encode characters in position 8-8: Non-BMP character not supported in Tk

转载 作者:太空宇宙 更新时间:2023-11-04 04:38:24 25 4
gpt4 key购买 nike

<分区>

请记住,我今天才开始学习 Python,所以我很糟糕。

您好,我正在为 Discord 编写一个机器人程序,但在运行时遇到了问题。我正在尝试将其联机,但我遇到了同样的错误。我不知道错误来自哪里。有人可以帮忙吗?

到目前为止,这是我的代码:

import discord

from discord.ext.commands import bot

from discord.ext import commands

import asyncio

import time

Client = discord.Client()

client = commands.Bot(command_prefix = "~")

@client.event
async def on_ready():

print("I'm up on some BOOF!" + client.user.id)
print("I am the" + client.user.name)

@client.event
async def on_message(message):

if message.content == "Boof":
await client.send_message(message.channel, ":b:")


client.run("<redacted>")

我得到的错误:

Ignoring exception in on_ready
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/discord/client.py", line 307, in _run_event
yield from getattr(self, event)(*args, **kwargs)
File "/Users/johnathanhelsel/Documents/Boof Bot/BoofBot.py", line 13, in on_ready
print("I am the" + client.user.name)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/idlelib/run.py", line 362, in write
return self.shell.write(s, self.tags)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/idlelib/rpc.py", line 604, in __call__
value = self.sockio.remotecall(self.oid, self.name, args, kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/idlelib/rpc.py", line 216, in remotecall
return self.asyncreturn(seq)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/idlelib/rpc.py", line 247, in asyncreturn
return self.decoderesponse(response)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/idlelib/rpc.py", line 267, in decoderesponse
raise what
UnicodeEncodeError: 'UCS-2' codec can't encode characters in position 8-8: Non-BMP character not supported in Tk

我绝对卡住了!我已经尝试了发布的所有解决方案,但没有任何效果。如果可以,请帮忙!

PS,我已经更改了 token ,甚至不要尝试。

谢谢 - 乔纳森

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com