0

Somehow I have fixed the previous error with error code 127 by adding poppler to my PATH environment variables, however now I am greeted by this new error. Does anyone have any clue what this could mean and how I can fix it. I am trying to run a tool which I have created on a MAC to read PDF's to text using textract. It works perfectly fine on MacOS However it seems to have issues running on windows. Any help would be much appreciated.

Thanks in advance :)

Exception in Tkinter callback
Traceback (most recent call last):
  File "tkinter\__init__.py", line 1883, in __call__
  File "\\Mac\Home\PycharmProjects\WickeyEinkaufAutomation\EinkaufRGWindows.py", line 40, in InkoopRekeningen
    text = textract.process(str(importfolder) + str(i))
  File "site-packages\textract\parsers\__init__.py", line 77, in process
  File "site-packages\textract\parsers\utils.py", line 46, in process
  File "site-packages\textract\parsers\pdf_parser.py", line 28, in extract
  File "site-packages\textract\parsers\pdf_parser.py", line 20, in extract
  File "site-packages\textract\parsers\pdf_parser.py", line 43, in extract_pdftotext
  File "site-packages\textract\parsers\utils.py", line 100, in run
textract.exceptions.ShellError: The command `pdftotext //Mac/Home/Desktop/WET/Rekeningen/Lekkerkerker_ - 20803471.pdf -` failed with exit code 3221225781
------------- stdout -------------
b''------------- stderr -------------
b''
Thomas Broek
  • 59
  • 2
  • 7
  • Check the command in your error message, the path doesn't seem logical... The spaces are not quoted and additionally `//Mac/Home` looks weird – CherryDT Aug 12 '20 at 08:55
  • @CherryDT It's called //Mac/Home because I am running it on a virtual machine through parallels, would removing spaces in the file name resolve the issue u think? – Thomas Broek Aug 12 '20 at 08:59
  • Try using `shlex.quote()` on the filename: `text = textract.process(shlex.quote(str(importfolder)+str(i)))`. – acw1668 Aug 12 '20 at 09:25
  • Shouldn't it be \\Mac\Home then? The slashes are in the wrong direction in your path. Also yes either don't use spaces or put the filename on quotes. – CherryDT Aug 12 '20 at 09:52

1 Answers1

0

Paths on MacOS and on windows use different slashes, thus it needs changes for a MacOS program to run on Windows too. Mac uses / slashes, and Windows - .

Dharman
  • 30,962
  • 25
  • 85
  • 135
MercifulSory
  • 337
  • 1
  • 14