Ask Your Question
1

how run soffice command as python process?

asked 2015-05-08 15:30:15 +0100

shee-eet gravatar image

updated 2015-05-08 15:31:20 +0100

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?

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
0

answered 2015-05-08 15:49:32 +0100

karolus gravatar image

updated 2015-05-08 16:26:03 +0100

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',

edit flag offensive delete link more

Comments

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.

shee-eet gravatar imageshee-eet ( 2015-05-08 17:27:22 +0100 )edit
0

answered 2015-05-08 17:15:44 +0100

shee-eet gravatar image

I've had some luck with this elsewhere:

http://stackoverflow.com/questions/30...

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2015-05-08 15:30:15 +0100

Seen: 1,612 times

Last updated: May 08 '15