chrismattmann / tika-python

Tika-Python is a Python binding to the Apache Tika™ REST services allowing Tika to be called natively in the Python community.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Using `InMemoryUploadFile` with tika.

hamodey opened this issue · comments

Hi,

I am posting a file into my db using BE framework of Django. I would like to read the data from the file whilst parsing.
However, I am getting the error:

AttributeError: 'InMemoryUploadedFile' object has no attribute 'decode'
I assume the issue is that the temp file that django handles differs to what tika is expecting, is there any suggestions or documentation I could have a look at?

Thanks

tika-python doesn't directly handle object streams in parser.from_file (you have to use .from_buffer). But the latest PR I just commit in this release should address that. Thanks @hamodey