Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I am getting this wand.exceptions.PolicyError: not authorized `//s3.amazonaws.com/esimplify1/store/temp.pdf' @ error/constitute.c/ReadImage/454 #355

Closed
sjagadee opened this issue Dec 7, 2017 · 3 comments

Comments

@sjagadee
Copy link

sjagadee commented Dec 7, 2017

Hi I am getting this error. Has anyone faced similar issue?

Traceback (most recent call last):
File "extract_from_s3.py", line 236, in
populateData(db)
File "extract_from_s3.py", line 216, in populateData
return_string = process_text_from_file(url)
File "extract_from_s3.py", line 15, in process_text_from_file
pdf = wand_image(filename=url, resolution=300)
File "/home/ec2-user/.local/lib/python3.6/site-packages/wand/image.py", line 2744, in init
self.read(filename=filename, resolution=resolution)
File "/home/ec2-user/.local/lib/python3.6/site-packages/wand/image.py", line 2822, in read
self.raise_exception()
File "/home/ec2-user/.local/lib/python3.6/site-packages/wand/resource.py", line 222, in raise_exception
raise e
wand.exceptions.PolicyError: not authorized `//s3.amazonaws.com/.../temp.pdf' @ error/constitute.c/ReadImage/454
Exception ignored in: <bound method Resource.del of <wand.image.Image: (empty)>>
Traceback (most recent call last):
File "/home/ec2-user/.local/lib/python3.6/site-packages/wand/resource.py", line 232, in del
File "/home/ec2-user/.local/lib/python3.6/site-packages/wand/image.py", line 2767, in destroy
TypeError: object of type 'NoneType' has no len()

Please help me resolve this issue, or atleast give me some suggestion to solve it. Thank you.

@emcconville
Copy link
Owner

Following the ImageTragick, all remote protocols should be disabled in policy.xml.

Use boto3 to pull/load an S3 object into an BytesIO stream, and pass to wand.image.Image.read(file=...) method.

@sjagadee
Copy link
Author

No I was not able to solve it by what you have suggested

@emcconville
Copy link
Owner

Closing this issue. The NoneType error was resolved with #346 ; however, you still have an outstanding PolicyError that is outside of the scope of this project. You'll need to updated the policy.xml file on your EC2 instance to allow reading PDF over HTTP

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants