acl-org / acl-org/aclpubcheck

PolicyError when trying to run formatchecker

Open
#56 0 comments 13 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1k
Forks
62
Avg merge
1d 3h
Merged PRs (30d)
2

Description

I installed into a fresh Python environment on openSUSE Leap 15.4:
``` shell
virtualenv -p /usr/bin/python3.9 venv-acl
source venv-acl/bin/activate
git clone git@github.com:acl-org/aclpubcheck.git
cd aclpubcheck/
pip install -e .
```

and get the following error when trying to run the formatchecker on my PDF:
```
cp -dpi ~/Downloads/absa-camera-ready-2023-05-25-T-1701.pdf ./
$ python3 aclpubcheck/formatchecker.py --paper_type long absa-camera-ready-2023-05-25-T-1701.pdf
Checking absa-camera-ready-2023-05-25-T-1701.pdf
Traceback (most recent call last):
File "/redacted/aclpubcheck/aclpubcheck/formatchecker.py", line 495, in
main()
File "/redacted/aclpubcheck/aclpubcheck/formatchecker.py", line 492, in main
worker(submission, args.paper_type)
File "/redacted/aclpubcheck/aclpubcheck/formatchecker.py", line 455, in worker
return Formatter().format_check(submission=pdf_path, paper_type=paper_type)
File "/redacted/aclpubcheck/aclpubcheck/formatchecker.py", line 80, in format_check
self.check_page_margin(output_dir)
File "/redacted/aclpubcheck/aclpubcheck/formatchecker.py", line 284, in check_page_margin
im = self.pdf.pages[page].to_image(resolution=150)
File "/redacted/venv-acl/lib/python3.9/site-packages/pdfplumber/page.py", line 431, in to_image
return PageImage(self, resolution=resolution or DEFAULT_RESOLUTION)
File "/redacted/venv-acl/lib/python3.9/site-packages/pdfplumber/display.py", line 95, in __init__
self.original = get_page_image(
File "/redacted/venv-acl/lib/python3.9/site-packages/pdfplumber/display.py", line 56, in get_page_image
with WandImage(
File "/redacted/venv-acl/lib/python3.9/site-packages/wand/image.py", line 9365, in __init__
self.read(filename=filename)
File "/redacted/venv-acl/lib/python3.9/site-packages/wand/image.py", line 10120, in read
self.raise_exception()
File "/redacted/venv-acl/lib/python3.9/site-packages/wand/resource.py", line 225, in raise_exception
raise e
wand.exceptions.PolicyError: attempt to perform an operation not allowed by the security policy `PDF' @ error/constitute.c/IsCoderAuthorized/422
```

Following https://stackoverflow.com/questions/52998331/imagemagick-security-policy-pdf-blocking-conversion,
adding the line
```

```
to `/etc/ImageMagick-7/policy.xml` before the last line `` allows the formatchecker to complete its task. Assuming the functionality has been deactivated due to a security-related bug, it will be best to only make this modification while no other users can access the system, no automatic processing of PDFs is active (indexers, email scanners etc.) and to restore the safe setting immediately.

Hope this helps other users running into this issue.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.