How run soffice command as python process?

Converting docs to text files…

I can verify that this command works from the linux command line:

soffice --headless --convert-to txt:"Text" document_to_convert.doc 

But I get an error when I try to run the same command from Python:

subprocess.call(['soffice', '--headless', '--convert-to', 'txt:"Text"', document_to_convert.doc])

Error: Please reverify input parameters…

How do I get the command to run from Python?

Of course, subprocess needs any Argument as Text

subprocess.call( ['soffice',
                 '--headless',
                 '--convert-to',
                 'txt:Text',
                 'document_to_convert.doc' ] ) 

Edit: Correct the invalid syntax 'txt:"Text"', to 'txt:Text',

Ah yes. I hadn’t really been using document_to_convert.doc. That was just for my example. The doc I was actually using in my own command was enclosed with quotes. Ta, karolus, for pointing this out.

I’ve had some luck with this elsewhere: