unoconv / unoserver

MIT License
598 stars 81 forks source link

Error converting from odt to txt #79

Closed ghost closed 1 year ago

ghost commented 1 year ago

Debian 11, libreoffice 7.0.4, python 3.9.2

It fails to convert from ODT to txt

unoconvert --convert-to txt myfile.odt /tmp/myfile.txt INFO:unoserver:Starting unoconverter. INFO:unoserver:Opening myfile.odt Traceback (most recent call last): File "/usr/local/bin/unoconvert", line 8, in sys.exit(main()) File "/usr/local/lib/python3.9/dist-packages/unoserver/converter.py", line 307, in main result = converter.convert( File "/usr/local/lib/python3.9/dist-packages/unoserver/converter.py", line 225, in convert raise RuntimeError( RuntimeError: Could not find an export filter from com.sun.star.text.TextDocument to writer_T602_Document

The weird part is that i can convert to csv is i do not provide an extension

unoconvert --convert-to csv myfile.odt /tmp/myfile INFO:unoserver:Starting unoconverter. INFO:unoserver:Opening myfile.odt INFO:unoserver:Exporting to /tmp/myfile INFO:unoserver:Using Text export filter

Then .. /tmp/myfile is the correct file.

Other tests worked without problem .. ODT to PDF and ODS to CSV

If nay doubt about libreoffice, it works well

soffice --headless --convert-to txt --outdir /tmp myfile.odt

ghost commented 1 year ago

Using backports I upgraded to libreoffice 7.4 and it now works OK

unoconvert --convert-to txt myfile.odt /tmp/myfile.txt INFO:unoserver:Starting unoconverter. INFO:unoserver:Opening myfile.odt INFO:unoserver:Exporting to /tmp/myfile.txt INFO:unoserver:Using MediaWiki export filter

It works now