Вот мой код -
@client.command()
async def invert(ctx, user: discord.User = None):
async with aiohttp.ClientSession() as session:
async with session.get(str(user.avatar_url)) as response:
image_bytes = await response.read()
img = Image.open(image_bytes)
await ImageOps.invert(img)
with io.BytesIO() as my_image:
img.save(my_image,
'PNG')
my_image.seek(0)
await ctx.send(file=discord.File(fp=my_image,
filename="image.png"))
И он дает ошибку -
Traceback (most recent call last):
File "C:\Users\k\AppData\Local\Programs\Python\Python36\lib\site-packages\discord\ext\commands\bot.py", line 892, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\k\AppData\Local\Programs\Python\Python36\lib\site-packages\discord\ext\commands\core.py", line 797, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\k\AppData\Local\Programs\Python\Python36\lib\site-packages\discord\ext\commands\core.py", line 92, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc2 in position 6: invalid continuation byte
Я никогда раньше не использовал PIL, поэтому любая помощь будет оценена.