422 Tika server response? Tika-Python

2019-08-28 00:52发布

问题:

I have been trying to get Apache-Tika to work with this python package: https://github.com/chrismattmann/tika-python

I have the following code in my python program:

#!/usr/bin/env python
import tika
tika.initVM()
from tika import parser
parsed = parser.from_file('pdf/myPdf.pdf')

But I get a 422 response every time:

[MainThread  ] [WARNI]  Failed to see startup log message; retrying...
[MainThread  ] [WARNI]  Tika server returned status: 422

Apache Tika does work when I use the following command:

java -jar tika-app-1.18.jar -t pdf/alnaggar2016lattice.pdf 

I really would like to fix this error with the Tika-Python package because it would be a lot easier for the rest of the project if this would work.