作者:Min2502857657_377 | 来源:互联网 | 2022-12-02 19:04
我在使用Wand将pdf转换为图像时遇到了这个问题:
E wand.exceptions.PolicyError: not authorized `/opt/sample.pdf' @ error/constitute.c/ReadImage/412
我已经访问过此前的堆栈溢出问题:
转换:未授权`aaaa` @ error/construct.c/ReadImage/453
这是我的代码
def build_image(self, pdf_path, img_path):
with wand.image.Image(filename=pdf_path) as img:
img.save(filename=img_path)
我的代码在过去6个月内处于工作状态.现在为什么我得到错误.
请帮忙.
1> 小智..:
这可能是由于底层包的安全修复(参见https://bugs.launchpad.net/ubuntu/+source/imagemagick/+bug/1796563)
我通过编辑/etc/ImageMagick-6/policy.xml修改了它,并将pdf行的权限更改为"read":