I am trying to write an addin for calc using python. I have found an example on the internet describing the basics (which I can reproduce for a simple case) that returns a single value. However when I try to return an array I get a #VALUE! error. I have included the information from the idl and python files to show the changes. I hope somebody can shed some light on the issue I am having as I find there is very little on python as the addin language and nothing on returning arrays with python.
##idl (working)

=OFFSET(Sheet1.A1;0;0;2;3) returns #VALUE as well since this function call is supposed to return 2x3 values (A1:C2) but a cell can take only one value. You've got to enter that formula as an array formula which can return more than one value at once._________________Rest in peace, oooforum.org
Get help on https://forum.openoffice.org

I admit that I am following the instructions on the post blindly as I do not quite understand the overall architecture but I still cannot get a satisfactory result. I do feel I am closer to the answer but still not quite there.

Here is what I have done... I have removed the real workings of my python function and replaced it with something that used native python types:

This should return a 3x3 array independent of the values fed to the function in Calc. However, I still get a value error when I enter the following in-cell formula:
'{=TRIANGULAR(1,2,3,4)}' -> '#VALUE!'

If I take the python function and use it directly in a python session I get the following output (which appears correct to me):

So I assume this is the structure that is being returned by my python function to Calc, when it is being called as an array function, from within a cell. But as I mentioned I am still getting a #VALUE! error. Can you see an error in what I have done? Or do you have any further insight into my problem?

No, sorry. I gave up OOo coding. It is a pointless waste of time. Today I noticed that my Basic wrappers for Python functions stopped working so I can not even try your function without building a complete add-in._________________Rest in peace, oooforum.org
Get help on https://forum.openoffice.org