我想将 pdf(一页)转换为 png 文件。我安装了 pdf2image 并收到此错误:popler 未安装在 Windows 中。
根据这个问题: Poppler in path for pdf2image,应该安装 poppler 并修改 PATH 。
我无法执行这些操作(我在正在使用的系统中没有必要的权限)。
我查看了 opencv 和 PIL,似乎都没有提供进行此转换的可能性:PIL(请参阅此处https://pillow.readthedocs.io/en/stable/handbook/image-file-formats.html?highlight= pdf#pdf)不提供阅读 pdf 的功能,只能将图像另存为 pdf。openCV 也是如此。
有什么建议如何将 pdf 转换为 png 吗?我可以安装任何 python 库,但无法触及 Windows 安装。
谢谢
如果应用程序未能在 3 秒内响应交互,Discord 将自动超时并触发自定义“此交互失败”消息。
然而,我正在运行一些稍长的任务,所以我调用该ctx.defer()方法,这给了我更多的时间来响应并显示“<application_name>正在思考...”动画不和谐端。
如果我的任务引发一些内部异常,我想手动触发“此交互失败”消息。Discord API 是否公开了这样做的方法?
我试图触发的消息
一个虚拟示例,使用discord-py-slash-command:
import discord
from discord.ext import commands
from discord_slash import SlashCommand, SlashContext
bot = commands.Bot(command_prefix="!", intents=discord.Intents.all())
slash = SlashCommand(bot)
@slash.slash(name="test")
async def _test(ctx: SlashContext):
await ctx.defer()
try:
assert 1==2
except AssertionError:
# Somehow trigger the error message
bot.run("discord_token")
Run Code Online (Sandbox Code Playgroud)