Skip to content

Visualizer fails with a PolicyError #170

@lukehsiao

Description

@lukehsiao

Describe the bug
This is a known bug caused by a recent change to ImageMagick and can be resolved by editing the policy file.

To Reproduce
In the tutorials, it will fail on this display call:

from fonduer.utils.visualizer import Visualizer
from hardware_utils import entity_to_candidates
vis = Visualizer(pdf_path)

# Get a list of candidates that match the FN[10] entity
fp_cands = entity_to_candidates(FP[10], test_cands[0])
# Display a candidate
vis.display_candidates([fp_cands[0]])

Error Logs/Screenshots
The user will see an error like:

PolicyError: not authorized `data/pdf/bc546-d.pdf' @ error/constitute.c/ReadImage/412
If applicable, add error logs or screenshots to help explain your problem.

When the Fonduer visualizer tries to display the PDF.

Additional context
The bug tracker for the issue on launchpad can be found here:

https://bugs.launchpad.net/ubuntu/+source/imagemagick/+bug/1796563

the change was introduced as a more secure default in the underlying package.

Work-around
A workaround for now is to simply change the policy in /etc/ImageMagick-6/policy.xml for PDFs to read.

<policy domain="coder" rights="read" pattern="PDF" />

Metadata

Metadata

Assignees

No one assigned

    Labels

    tutorialsRelated to the tutorialswontfixThis will not be worked on

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions