unoconv / unoconv

Universal Office Converter - Convert between any document format supported by LibreOffice/OpenOffice.
http://dag.wieers.com/home-made/unoconv/
GNU General Public License v2.0
2.55k stars 373 forks source link

Python 3.9.2 - Streams #605

Closed kirilkirkov closed 10 months ago

kirilkirkov commented 10 months ago

is it possible to use with streams?

const unoconv = spawn("unoconv", ["-f", "docx", "--stdin", "--stdout"]); ?

I get errors:

.. TypeError: Expected bytes object or ByteSequence, got <class 'str'> instead.

regebro commented 10 months ago

Python 3 will default to treating stdin and stdout as str, so that is likely how you will have to handle it.

kirilkirkov commented 10 months ago

@regebro Can you give some simple example?

regebro commented 10 months ago

I don't know how you are using it, why, or where that spawn function comes from, so I can't help you there.

kirilkirkov commented 10 months ago

@regebro I am using nodejs, the idea is to read the stream from google bucket and then to write it there. Currently with spawn i am calling the unoconv and i pass the streams, but i got the above error. Did you mean that with Python3 i need to convert the stream type before passing it?

regebro commented 10 months ago

I don't know anything about either nodejs or Google buckets, so I can't help you there. I guess using files isn't an option?