Page 1 of 1

[Solved] Python resolver.resolve Attribute Error 'NoneType'

PostPosted: Mon Feb 05, 2018 9:24 pm
by Siddmonk
Hello All,
I'm trying to follow a tutorial on github ("openoffice-libreoffice-automate-your-office-tasks-with-python-macros"), and I can only get about 5 lines in before I raise an error.

Import socket
import uno

localContext = uno.getComponentContext()
resolver = localContext.ServiceManager.createInstanceWithContext('com.sun.star.bridge.UnoResolver', localContext)
ctx = resolver.resolve("uno:socket,host=localhost,port=2002;urp;StarOffice.ComponentContext")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'NoneType' object has no attribute 'resolve'

This is all entered from the python shell in OpenOffice 4\programs\python.exe

I've scoured the forum(and the web in general) but I haven't seen anyone encounter this error. If anyone can point me in the right direction i would certainly appreciate it.

Re: Python resolver.resolve Attribute Error 'NoneType'

PostPosted: Mon Feb 05, 2018 9:45 pm
by RoryOF
Have you a document open to which to connect?

Re: Python resolver.resolve Attribute Error 'NoneType'

PostPosted: Mon Feb 05, 2018 9:48 pm
by Siddmonk
Yes the document was also launched from the command line soffice --writer "accept=socket,host=localhost,port=2002;urp;"
And is open when I make the call to resolver.resolve

Re: Python resolver.resolve Attribute Error 'NoneType'

PostPosted: Mon Feb 05, 2018 10:15 pm
by Siddmonk
Just realized I had installed uno globally and wasn't sure if that would cause an error. So I uninstalled it and I no longer get the error. Thank you for your help.