Description: Some uno functions, e.g. XPropertySet.setPropertyValue, accept arguments that can be of type Any("[]String"). Calling such a method with a tuple of strings (which would correspond to what's returned by getProperty) gives "inappropriate property value". What appears to happen (from debugging with PYSCRIPT_LOG_LEVEL=DEBUG PYUNO_LOGLEVEL=ARGS ) is that the tuple of strings get's converted into a Any of type []Any with each element of the list being an Any of type String. Manually calling with uno.invoke(..., "setPropertyValue", ("myprop", uno.Any("[]String", mytupleofstr))) works, as described in https://forum.openoffice.org/en/forum/viewtopic.php?t=56460 Steps to Reproduce: Create a property of type []String in a python extension. Try to read -> works, gives tuple of Strings. Try to write -> doesn't work, uno.invoke works. Actual Results: try py->uno[0x561181e85c80].setPropertyValue((string)"lstFoo", ([]any){ (any){ (string)"Apples" }, (any){ (string)"Bananas" }, (any){ (string)"Oranges" }, (any){ (string)"Grapes" } }) except py->uno[0x561181e85c80].setPropertyValue = (com.sun.star.lang.IllegalArgumentException){ (com.sun.star.uno.RuntimeException){ (com.sun.star.uno.Exception){ Message = (string)"configmgr inappropriate property value", Context = (com.sun.star.uno.XInterface)0x56117709f6e0 } }, ArgumentPosition = (short)0x-1 } Expected Results: Conversion being to Any("[]String", ...). Reproducible: Always User Profile Reset: No Additional Info:
see the mailing list thread starting at <https://lists.freedesktop.org/archives/libreoffice/2019-May/082763.html> "Converting Python Tuples / Lists into Any in PyUNO"
Have a look here. Could be useful. https://cgit.freedesktop.org/libreoffice/core/commit/?id=af8143bc40cf2cfbc12e77c9bb7de01b655f7b30 https://conference.libreoffice.org/assets/Conference/Aarhus/Slides/MatthewFrancisPyUNO.pdf I don’t know if there is more doc on this topic.
Thanks Oliver! Those are great resources! (And I do sometimes look at the grammalecte plugin for inspiration of how PyUNO works, too) So slide 18 (Elimination of explicit Any) is very close to my case. The implicit conversion to any here would be not to "string[]" as I would expect from the example, but to any[]. Maybe you or Matthew have an opinion on whether that's intentional or maybe less so?
Actually, I haven’t tried these new syntaxes for compatibility issues with older versions of LibreOffice. But as I dropped support for LOs < 5.3 recently, I will try that when I have the courage to dig in my code. But I’m not familiar at all with LibreOffice internals, I have no opinion on your issue. I’m even surprised that my plugin could be inspirative, as I often feel more like I’m struggling with the LO API than really using it.
So there is a brief discussion here: https://lists.freedesktop.org/archives/libreoffice/2019-May/082782.html (I didn't do the research mentioned there, though) When we shy away from changing the auto-conversion, a partial mitigation might be to allow Any arguments to be passed to methods. This would still have us doing the Any conversion explicitly, but we would not have to resort to uno.invoke, giving a 50% more pythonic feel to it.
Bjoern Michaelsen committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/1cd495900883d1677670787669908535cd33babe tdf#125307: move range properties check to own test It will be available in 6.4.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
A polite ping to Thomas Viehmann: Is this bug fixed? if so, could you please close it as RESOLVED FIXED ? Otherwise, Could you please explain what's missing? Thanks
This issue continues to exist. The problem is that it is potentially backwards compatibility-breaking to fix it (see the mailing list discussion).
This is another instance: https://ask.libreoffice.org/en/question/251641/pyuno-illegalargumentexception/
Dear Thomas Viehmann, To make sure we're focusing on the bugs that affect our users today, LibreOffice QA is asking bug reporters and confirmers to retest open, confirmed bugs which have not been touched for over a year. There have been thousands of bug fixes and commits since anyone checked on this bug report. During that time, it's possible that the bug has been fixed, or the details of the problem have changed. We'd really appreciate your help in getting confirmation that the bug is still present. If you have time, please do the following: Test to see if the bug is still present with the latest version of LibreOffice from https://www.libreoffice.org/download/ If the bug is present, please leave a comment that includes the information from Help - About LibreOffice. If the bug is NOT present, please set the bug's Status field to RESOLVED-WORKSFORME and leave a comment that includes the information from Help - About LibreOffice. Please DO NOT Update the version field Reply via email (please reply directly on the bug tracker) Set the bug's Status field to RESOLVED - FIXED (this status has a particular meaning that is not appropriate in this case) If you want to do more to help you can test to see if your issue is a REGRESSION. To do so: 1. Download and install oldest version of LibreOffice (usually 3.3 unless your bug pertains to a feature added after 3.3) from https://downloadarchive.documentfoundation.org/libreoffice/old/ 2. Test your bug 3. Leave a comment with your results. 4a. If the bug was present with 3.3 - set version to 'inherited from OOo'; 4b. If the bug was not present in 3.3 - add 'regression' to keyword Feel free to come ask questions or to say hello in our QA chat: https://web.libera.chat/?settings=#libreoffice-qa Thank you for helping us make LibreOffice even better for everyone! Warm Regards, QA Team MassPing-UntouchedBug