Simple python script to start the OpenOffice software. This script starts OpenOffice software. The script uses the following modules:
| import os import sys import time import uno import subprocess |
Now we define the arguments for each software OpenOffice:
| NoConnectionException = uno.getClass("com.sun.star.connection.NoConnectException") ooffice = 'ooffice "-accept=socket,host=localhost,port=8100;urp;"' oocalc = 'oocalc "-accept=socket,host=localhost,port=8100;urp;"' ooimpress = 'ooimpress "-accept=socket,host=localhost,port=8100;urp;"' oowriter = 'oowriter "-accept=socket,host=localhost,port=8100;urp;"' |
The next step, we define a function that will start OpenOffice software. See below:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | def OOo(soft): ''' start ooo software ''' # using fork if os.fork(): return # Start OpenOffice.org and report any errors that # occur. try: retcode = subprocess.call(soft, shell=True) if retcode < 0: print >>sys.stderr,"retcode is ",-retcode elif retcode > 0: print >>sys.stderr,"retcode is ",retcode except OSError, e: print >>sys.stderr, "Error is :", err raise SystemExit() |
We use a variable to… Continue Reading Python and OpenOffice – Start OpenOffice.