Description: As said in the summary, I get nothing but 0. Expected result: True if the given object is an UNO object. See also: https://ask.libreoffice.org/t/c-s-s-text-mailmergetype-shell-4/80148/9 Steps to Reproduce: 1. A Python script: import uno def test_isInstance(): doc = XSCRIPTCONTEXT.getDocument() print(uno.isInstance(doc) 2. store the script under <profile>/Scripts/python/testInstance.py 3. Start the office from a terminal window, load any kind of document and run the macro. Actual Results: prints 0 to the terminal Expected Results: print True to the terminal since XSCRIPTCONTEXT.getDocument() refers to the currently active document model which is certainly an UNO object. Reproducible: Always User Profile Reset: No Additional Info: I tested this with various UNO objects that occur in my current project. Always 0.
AFAIK uno.py does not have a method named isInstance so calling it would cause an error. See the contents of uno.py and this method does not exist: https://opengrok.libreoffice.org/xref/core/pyuno/source/module/uno.py?r=c7568cfd Maybe you're referring to the isInterface method?
Yes, I mean isInterface.
Note: the code in comment 0 additionally misses the closing parenthesis. It should be import uno def test_isInstance(): doc = XSCRIPTCONTEXT.getDocument() print(uno.isInterface(doc)) I tried it using Version: 7.4.0.2 (x64) / LibreOffice Community Build ID: 1512ce97d7ed39dce3121f7e15651fd8895f950e CPU threads: 12; OS: Windows 10.0 Build 19044; UI render: Skia/Raster; VCL: win Locale: ru-RU (ru_RU); UI: en-US Calc: CL and indeed, it works as described. Then I modified it like this: import uno def test_isInstance(): doc = XSCRIPTCONTEXT.getDocument() print(uno.isInterface(uno.getClass("com.sun.star.uno.XInterface"))) and it returned 1. I really don't know what the isInterface might be used for, but it looks like it expects some type meta-objects, not actual interface implementations.
OK. Close this.
[Automated Action] NeedInfo-To-Unconfirmed