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

Adding conda poppler to PATH #265

Open
2V3EvG4LMJFdRe opened this issue Apr 7, 2023 · 1 comment
Open

Adding conda poppler to PATH #265

2V3EvG4LMJFdRe opened this issue Apr 7, 2023 · 1 comment

Comments

@2V3EvG4LMJFdRe
Copy link

2V3EvG4LMJFdRe commented Apr 7, 2023

I'm trying to get poppler installed on macOS. brew install poppler seems to get stuck, so I've installed it through conda, but because I'm unfamiliar with conda, I have no idea how to specify the pages = convert_from_path(filepath, poppler_path=r"actualpoppler_path") line.


As it is now:

/usr/local/bin/python3 <<'EOF' - "$@"

from pdf2image import convert_from_path, convert_from_bytes

from pdf2image.exceptions import (
    PDFInfoNotInstalledError,
    PDFPageCountError,
    PDFSyntaxError
)

import tempfile

with tempfile.TemporaryDirectory() as path:
    images_from_path = convert_from_path('/Users/test.pdf', output_folder=path)
    # Do something here

EOF

The script naturally warns me

The action “Run Shell Script” encountered an error: “Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pdf2image/pdf2image.py", line 568, in pdfinfo_from_path
    proc = Popen(command, env=env, stdout=PIPE, stderr=PIPE)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 951, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 1821, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'pdfinfo'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 13, in <module>
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pdf2image/pdf2image.py", line 127, in convert_from_path
    page_count = pdfinfo_from_path(
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pdf2image/pdf2image.py", line 594, in pdfinfo_from_path
    raise PDFInfoNotInstalledError(
pdf2image.exceptions.PDFInfoNotInstalledError: Unable to get page count. Is poppler installed and in PATH?”
@2V3EvG4LMJFdRe
Copy link
Author

2V3EvG4LMJFdRe commented Apr 9, 2023

Solved for me, I ended up installing with brew. It took centuries, I'd never seen it happen before. I basically forgot I had the window running and came the next day to see poppler had been installed.

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

1 participant