Python Forum
PolicyError: not authorized `JRF-DEO.pdf' @ error/constitute.c/ReadImage/412
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PolicyError: not authorized `JRF-DEO.pdf' @ error/constitute.c/ReadImage/412
#1
Hi,

I am getting above error fro below code. This is I am running in Ubuntu and connected through SSH and Jupyter

from wand.image import Image as Img
with Img(filename="JRF-DEO.pdf", resolution=300) as img:
 img.compression_quality = 99
 img.save(filename="sample_scan.jpg")
---------------------------------------------------------------------------
PolicyError                               Traceback (most recent call last)
<ipython-input-27-5af7d0a73aff> in <module>()
      1 from wand.image import Image as Img
----> 2 with Img(filename="JRF-DEO.pdf", resolution=300) as img:
      3  img.compression_quality = 99
      4  img.save(filename="sample_scan.jpg")

/anaconda/envs/py35/lib/python3.5/site-packages/wand/image.py in __init__(self, image, blob, file, filename, format, width, height, depth, background, resolution, pseudo)
   4603                     self.read(blob=blob, resolution=resolution)
   4604                 elif filename is not None:
-> 4605                     self.read(filename=filename, resolution=resolution)
   4606                 # clear the wand format, otherwise any subsequent call to
   4607                 # MagickGetImageBlob will silently change the image to this

/anaconda/envs/py35/lib/python3.5/site-packages/wand/image.py in read(self, file, filename, blob, resolution)
   4894             r = library.MagickReadImage(self.wand, filename)
   4895         if not r:
-> 4896             self.raise_exception()
   4897 
   4898     def save(self, file=None, filename=None):

/anaconda/envs/py35/lib/python3.5/site-packages/wand/resource.py in raise_exception(self, stacklevel)
    220             warnings.warn(e, stacklevel=stacklevel + 1)
    221         elif isinstance(e, Exception):
--> 222             raise e
    223 
    224     def __enter__(self):

PolicyError: not authorized `JRF-DEO.pdf' @ error/constitute.c/ReadImage/412
Thanks
Reply
#2
updated image magic policy for pdf to read|write and restarted the system
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020