[Tutor] adapting a converter openoffice

Tim Michelsen timmichelsen at gmx-topmail.de
Thu Jul 26 22:51:15 CEST 2007


Hello,
I am Python learning in an early stage.

I am currently trying to code a converter for openoffice based on 
PyODConverter:
http://www.artofsolving.com/opensource/pyodconverter

My goal is to be able to run my script from anywhere in the system (put 
it in Path) and then convert a file from/to openoffice formats to other 
formats such as doc/pdf etc.

My main problem is how to issue system commands and then run the above 
script.

PyODConverter needs OpenOffice.org to be running as a service which can 
be initiated through the following command on the command line (linux 
shell):
soffice -headless -accept="socket,port=8100;urp;"

once the service is up and running the conversion process is really 
straight forward:
python DocumentConverter.py test.odt test.pdf
where DocumentConverter.py is the ready-to-use converter program 
downloadable at http://www.artofsolving.com/opensource/pyodconverter

I want to be able to convert the files anywhere without the need to 
start the OOo service seperately.

Therefore I tried to add this code on top of the original converter:

###get OOo service started first:
import os
code = os.system('soffice -headless -accept="socket,port=8100;urp;"') # 
Just execute the command, return a success/fail code

when I execute this script nothing happens and I would have to cancel it.

Is there any way to start the OOo service from a python script?

Thanks in advance for your help!

Timmie



More information about the Tutor mailing list