Openoffice3.1 pyuno confuse errors
I am trying to get sample and other code samples I find for pyuno working with openoffice 3.1.1 and python 2.5 with no luck.
Unfortunately pyuno doesn't give any clues as to what is going wrong.
In [1]: import uno In [2]: local = uno.getComponentContext () In [3]: resolver = local.ServiceManager.createInstanceWithContext ("com.sun.star.bridge.UnoUrlResolver", local) -------------------------------------------------- ------------------------- com.sun.star.uno.RuntimeException Traceback (most recent call last) /opt/openoffice.org/basis3.1/program/ in () com.sun.star.uno.RuntimeException:: 'tuple' object has no attribute 'getTypes', traceback follows no traceback available
below is the output of running /opt/openoffice.org/basis3.1/program/officehelper.py which basically loads the headless office instance and returns the associated context object.
den @ ev : /opt/openoffice.org/basis3.1/program> python officehelper.py Traceback (most recent call last): File "officehelper.py", line 42, in from com.sun.star.connection import NoConnectException File "uno.py", line 273, in _uno_import RuntimeException = pyuno.getClass ("com.sun.star.uno.RuntimeException") RuntimeError: pyuno.getClass: expecting one string argument
pyuno only takes 1 argument and it must be a string as defined at http://udk.openoffice.org/source/browse/udk/pyuno/source/module/pyuno_module.cxx?rev=1.14&view=markup I don't care failed to get pyuno.getClass to work.
any suggestions on how to get pyuno to work?
source to share
In [1]: import uno In [2]: local = uno.getComponentContext () In [3]: resolver = local.ServiceManager.createInstanceWithContext ("com.sun.star.bridge.UnoUrlResolver", local)
OOP went wrong, IMHO. I know his OT, but I tried to get uno to work before and gave up. this is pure Simple Steve Egge (read http://steve-yegge.blogspot.com/2006/03/execution-in-kingdom-of-nouns.html ).
when you translate these lines into a clearer form, they come out like this:
Let 'local' be the result of calling the 'get component context' method from 'uno'. Let 'service manager' be the attribute of 'service manager' 'local'. Let 'resolver' be the result of calling the 'service manager' method 'instantiate with context "using the arguments" sun sun star bridge uno url resolver "and" local ".
OMG. it is not surprising that there is something wrong with a program that is so terribly over-specific, confusing and self-reflective without being self-aware ... you call the sub-method "local" and that sub-method must be specified that mean "local"? what? hats to the fearless developers who can cut through this. happy debugging.
ADDED:
thanks for the comments and points.
a pyuno problem that I can't do anything about at all, but I urge to endure the patient's patient approach with a clear deadline.
I also suggest writing a straight BUG with the pyuno people (if they are actually active - I was under the impression it was a pretty quiet project) due to the pointless error message: the method in question asks for one string argument and it gets one and it complains he did. it doesn't help that much to the extent that it makes sense to declare a code error.
in such a situation, I often look at sources. but you've already done that, right?
I hate people to ask, “Why do you want to do this? When I ask for help. However, sometimes someone (maybe you) comes up with another workable way in this process, which does not involve solving a specific problem, but helps to solve more difficult task.so if I may ask: what is the big picture?
source to share