【发布时间】:2020-08-05 03:01:05
【问题描述】:
我正在尝试让我的机器人下载图像,将其更改为 url,然后将其嵌入 Discord py 中。但是在将文件更改为url的过程中,永远找不到文件的目录。这是我用来将文件更改为 url 的代码:
f = discord.File(f"/Desktop/Bot/Dino_Battles/DinoBattle_{str(ctx.author.id)}_VS_{str(user.id)}.jpg", filename = f'DinoBattle_{str(ctx.author.id)}_VS_{str(user.id)}.jpg')
但是,我总是收到一个错误,即即使图像存在也无法找到该目录。 这是错误:
FileNotFoundError: [Errno 2] No such file or directory: '/Desktop/Bot/Dino_Battles/DinoBattle_628693454754676768_VS_725411116272058369.jpg
这是文件目录:
C:\Users\lbart\Desktop\Bot\Dino_Battles\DinoBattle_628693454754676768_VS_725411116272058369.jpg
discord 怎么找不到文件? 很抱歉,如果这令人困惑。
【问题讨论】:
标签: python python-3.x discord.py