textract cannot find a pdf file python

Viewed 274

I have the following simple code:

import textract

text = textract.process("text.pdf")

However, I got the following error:

FileNotFoundError: [WinError 2] The system cannot find the file specified

But I am sure that I have a file called text.pdf in the current directory. Nevertheless, if I create a document called a.txt and change the second line of the code to:

text = textract.process("a.txt", extension='txt')

Then the problem disappears. I also tried:

text = textract.process("text.pdf", extension='pdf')

But I got the same error as before.

Thank you in advance for your help.

0 Answers
Related