Have been looking for a solution to this problem for a while now and have not come up with a solution.
Trying to open a calc document with OO-python and getting
errorAttributeError: loadComponentFromUrl
Running on Windows 10 installation.
First trying with OpenOffice 4.1.11 and included python.
Then tying with LibreOffice 7.2.4.1 (x64) version.
Both gives the same error.
Have tried with the "URE_BOOTSTRAP" and changing the spaces to %20 but no success.
Code: Select all
C:\Program Files\LibreOffice\program>.\python
Python 3.8.10 (default, Dec 3 2021, 01:18:43) [MSC v.1928 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import socket
>>> import os
>>> import uno
>>> import unohelper
>>> localContext = uno.getComponentContext()
>>> resolver = localContext.ServiceManager.createInstanceWithContext(
... "com.sun.star.bridge.UnoUrlResolver", localContext )
>>> ctx = resolver.resolve( "uno:socket,host=localhost,port=2002;urp;StarOffice.ComponentContext" )
>>> smgr = ctx.ServiceManager
>>> desktop = smgr.createInstanceWithContext( "com.sun.star.frame.Desktop",ctx)
>>> model = desktop.getCurrentComponent()
>>> sURL = "e:\Test.ods"
>>> systemURL = uno.systemPathToFileUrl(sURL)
>>> oDocument = desktop.loadComponentFromUrl(systemURL,"_blank",0, tuple())
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: loadComponentFromUrl
>>> print(os.environ["URE_BOOTSTRAP"])
file:///C:/Program%20Files/LibreOffice/program/fundamental.ini
So, made a VM with Ubunto and LibreOffice 6.4.7.2 and get the same AttributeError: loadComponentFromUrl as with Windows.