Can anyone point me in the right direction to correct this python UNO
error?
I need to run a one-time conversion from a folder full of .docx files to
The target for the conversion is on Ubuntu Linux 7.10, which I think has
special OOXML handling features, and the system python is used for the UNO
modules, but I'm getting the same error on my own computer's Gentoo Linux.
Since the error message is fairly inscrutable, I don't know if I'm
reaching the point where file format matters at all. What is reason (21)?
In case it isn't clear from the code below, OOoLib.py is in the same
directory as the .docx files.
Thanks for any help,
Jeff
On Gentoo Linux, openoffice.org-bin-2.3.1, using bundled python and OOoLib
helper:
$ ooffice "-accept=socket,host=localhost,port=8100;urp;" -invisible
/usr/lib/openoffice/program $ ./python
Python 2.3.4 (#1, Aug 8 2007, 18:47:03)
[GCC 3.4.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import uno
>>> import sys
>>> sys.path.append(r'/archives/docx')
>>> import OOoLib
>>> import os.path
>>> import glob
>>> desktop = OOoLib.getDesktop()
>>> import unohelper
>>> for file in glob.glob('/archives/docx/*.docx'):
... url = unohelper.systemPathToFileUrl('file://' +
os.path.abspath(file))
... doc = desktop.loadComponentFromURL('file://' + url, "_blank", 0, ()
)
... to_url = url.replace('.xls', '.ods')
... doc.storeToURL(to_url, ())
... doc.close(True)
...
Traceback (most recent call last):
File "<stdin>", line 2, in ?
File "unohelper.py", line 187, in systemPathToFileUrl
return pyuno.systemPathToFileUrl( systemPath )
uno.com.sun.star.uno.RuntimeException: Couldn't convert
file:///archives/docx/WM122436.docx to a file url for reason (21)
>>>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]