Wand Policy Error: error/constitute.c/ReadImage/412

泄露秘密 提交于 2019-12-04 00:16:50

问题


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

I have already visited the previous stack overflow question here: convert:not authorized `aaaa` @ error/constitute.c/ReadImage/453

Here is my code

def build_image(self, pdf_path, img_path):
    with wand.image.Image(filename=pdf_path) as img:
        img.save(filename=img_path)

My code was working form last 6 months. now why i am getting error.

Please help.


回答1:


This is probably due to an security fix of the underlaying package (see https://bugs.launchpad.net/ubuntu/+source/imagemagick/+bug/1796563)

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" />


来源:https://stackoverflow.com/questions/52699608/wand-policy-error-error-constitute-c-readimage-412

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!