Thursday 15 July 2010

Newbie in python : pyodconverter with Apache OpenOffice 4 on Windows -



Newbie in python : pyodconverter with Apache OpenOffice 4 on Windows -

i don't know python, , need convert documents pyodconverter on windows (xp , 7). utilize simple illustration given here : http://www.oooninja.com/2008/02/batch-command-line-file-conversion-with.html

"c:\program files\openoffice.org2.4\program\soffice.exe" -headless -nologo -norestore -accept=socket,host=localhost,port=2002;urp;staroffice.servicemanager "c:\program files\openoffice.org2.4\program\python" documentconverter.py test.odt test.pdf

it works charm path soffice.exe openoffice 3, openoffice 4 message :

importerror: no module named uno

and goes on every other module imported (from os.path import abspath, isfile, splitext com.sun.star.beans import propertyvalue com.sun.star.task import errorcodeioexception com.sun.star.connection import noconnectexception)

but if re-create , execute documentconverter.py in same directory python.exe, works. must path issue.

i can't phone call documentconverter.py dir, must called dir but can modify documentconverter.py or add together other files in same dir.

i see directory construction between openoffice 3 , 4 has changed no clue why works 3 , not 4. thought ?

you have modify search path when using documentconverter.py openoffice 4.

python.exe openoffice 4 seems utilize relative search path instead of absolute ones, that's why error when executing documentconverter.py directory one, openoffice 4 installed.

i solve problem adding next lines of code before 'import uno' command in documentconverter.py:

import sys sys.path.append("c:\program files (x86)\openoffice 4\program")

python windows openoffice.org

No comments:

Post a Comment