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

support python3.12 #502

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions textract/parsers/pdf_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
from .utils import ShellParser
from .image import Parser as TesseractParser

from distutils.spawn import find_executable
try:
from shutil import which
except ImportError:
from distutils.spawn import find_executable as which

class Parser(ShellParser):
"""Extract text from pdf files using either the ``pdftotext`` method
Expand Down Expand Up @@ -49,7 +52,7 @@ def extract_pdfminer(self, filename, **kwargs):
#Nested try/except loops? Not great
#Try the normal pdf2txt, if that fails try the python3
# pdf2txt, if that fails try the python2 pdf2txt
pdf2txt_path = find_executable('pdf2txt.py')
pdf2txt_path = which("pdf2txt.py")
try:
stdout, _ = self.run(['pdf2txt.py', filename])
except OSError:
Expand Down