-1

How to read an .odt file from an url? I am not able to achieve that at the moment.

I tried this code

from ODTReader.odtreader import odtToText

url="https://abc.s3.ap-south-1.amazonaws.com/sample1.odt"
docs = BytesIO(requests.get(url).content)
odt_text = odtToText(docs)
print("odt_text ",odt_text)

but its giving me error

  File "C:\ProgramData\Anaconda3\lib\site-packages\ODTReader\odtreader.py", line 24
    print "Could not find 'content.xml': {}".format(str(e))
          ^
SyntaxError: invalid syntax
  • Looks like [ODTReader only supports python2.7](https://pypi.org/project/ODTReader/#description). The project does not seem to be maintained any more, so I suggest you look for a different package. You could try [odfpy](https://pypi.org/project/odfpy), which supports python3 and is still actively maintained. – ekhumoro Jan 19 '21 at 15:10

1 Answers1

2

Looks like your ODTReader is written in python2, so try to setup your ODTReader for python3.

Edit:

I googled a bit and I think there is no library for python3, but I found this:

Maybe that helps you.

kabr8
  • 341
  • 1
  • 2
  • 19