2

The below code works fine for txt file but doesn't work with pdf files.

import textract
text = textract.process(r'C:\Users\Python_files\accounts.txt')

However, I cannot seem to figure out what the problem is in the below code snippet:

import textract
path = r'C:\Users\Python_files\accounts.pdf'
text = textract.process(path)

The above code results in the following error:

ShellError: The command `pdftotext C:\Users\Python_files\accounts.pdf -` failed with exit code 127
------------- stdout -------------
------------- stderr -------------
M Z
  • 4,571
  • 2
  • 13
  • 27
  • Do you have `pdftotext` installed? And does the file actually exist? Something you can do to debug is just run the shell command that failed directly, and see if it works. – M Z Apr 27 '23 at 06:41

0 Answers0