Command raised an exception: TypeError: 'Image' object is not callable, please some one look for it?

Command raised an exception: TypeError: 'Image' object is not callable, please some one look for it?

from PIL import Image
from io import BytesIO

...

@client.command()
async def rip(ctx, member:discord.Member=None):
    if not member:
        member = ctx.author
    
    rip = Image.open("rip.jpeg")
    
    asset = member.avatar_url_as(size=128)
    data = BytesIO(await asset.read())
    pfp = Image.open(data)
    
    pfp = pfp.resize((850,850))
    
    rip.paste(pfp (489, 1169))
    
    rip.save("prip.jpg")
    
    await ctx.send(file = discord.File("prip.jpg"))

错误:Command raised an exception: TypeError: 'Image' object is not callable

也许你可以试试这个:

with open('my_image.png', 'rb') as f:
picture = discord.File(f)
await channel.send(file=picture)

它已经在 discord.py 中,所以您不需要导入任何东西(discor 除外

就放

rip.close()

最后,你会很高兴!