魔杖政策错误:error/constitute.c/ReadImage/412 [英] Wand Policy Error: error/constitute.c/ReadImage/412
问题描述
使用魔杖将pdf转换为图像时,我遇到了问题:
I am facing the issue while converting pdf to image using Wand:
E wand.exceptions.PolicyError: not authorized `/opt/sample.pdf' @ error/constitute.c/ReadImage/412
我已经在这里访问了上一个堆栈溢出问题: convert:未授权的"aaaa" @ error/constitute.c/ReadImage/453
I have already visited the previous stack overflow question here: convert:not authorized `aaaa` @ error/constitute.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个月处于工作状态.现在,为什么会出现此错误?
My code was working form last 6 months. Now, why am I getting this error?
请帮助.
推荐答案
This is probably due to an security fix of the underlaying package (see https://bugs.launchpad.net/ubuntu/+source/imagemagick/+bug/1796563)
我通过编辑/etc/ImageMagick-6/policy.xml为我修复了该问题,并将pdf行的权限更改为"read":
I fixed it for me by editing the /etc/ImageMagick-6/policy.xml and changed the rights for the pdf line to "read":
<policy domain="coder" rights="read" pattern="PDF" />
这篇关于魔杖政策错误:error/constitute.c/ReadImage/412的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!