Description: =Call_VOL(1,2,3)'6 Later when run Data->Calculate->Recalculate Hard is ok ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Function Call_VOL(x,y,z) Dim oScript: oScript = GetPythonScript("WinTool.py$VOL","document") Call_VOL=convPy2Basic(oScript.invoke(array(x,y,z), array(), array())) End Function Public Function GetPythonScript(macro As String, Optional location As String) As com.sun.star.script.provider.Xscript ''' Grab Python script object before execution ' Arguments: ' macro : as "library/module.py$macro" or "module.py$macro" ' location: as "document", "share", "user" or ENUM(eration) ' Result: ' located com.sun.star.script.provider.XScript UNO service''' If IsMissing(location) Then location = "user" Dim mspf As Object ' com.sun.star.script.provider.MasterScriptProviderFactory Dim sp As Object ' com.sun.star.script.provider.XScriptProvider compatible Dim uri As String If location="document" Then sp = ThisComponent.getScriptProvider() Else mspf = CreateUNOService("com.sun.star.script.provider.MasterScriptProviderFactory") sp = mspf.createScriptProvider("") End If uri = "vnd.sun.star.script:"& macro &"?language=Python&location="& location GetPythonScript = sp.getScript(uri) End Function ' GetPythonScript Actual Results: =Call_VOL(1,2,3)'6 Error Expected Results: =Call_VOL(1,2,3)'6 Reproducible: Always User Profile Reset: No Additional Info: Later when run Data->Calculate->Recalculate Hard is ok
Can you provide a file with your macro?
Dear Nerijus, This bug has been in NEEDINFO status with no change for at least 6 months. Please provide the requested information as soon as possible and mark the bug as UNCONFIRMED. Due to regular bug tracker maintenance, if the bug is still in NEEDINFO status with no change in 30 days the QA team will close the bug as INSUFFICIENTDATA due to lack of needed information. For more information about our NEEDINFO policy please read the wiki located here: https://wiki.documentfoundation.org/QA/Bugzilla/Fields/Status/NEEDINFO If you have already provided the requested information, please mark the bug as UNCONFIRMED so that the QA team knows that the bug is ready to be confirmed. Thank you for helping us make LibreOffice even better for everyone! Warm Regards, QA Team MassPing-NeedInfo-Ping
Dear Nerijus, Please read this message in its entirety before proceeding. Your bug report is being closed as INSUFFICIENTDATA due to inactivity and a lack of information which is needed in order to accurately reproduce and confirm the problem. We encourage you to retest your bug against the latest release. If the issue is still present in the latest stable release, we need the following information (please ignore any that you've already provided): a) Provide details of your system including your operating system and the latest version of LibreOffice that you have confirmed the bug to be present b) Provide easy to reproduce steps – the simpler the better c) Provide any test case(s) which will help us confirm the problem d) Provide screenshots of the problem if you think it might help e) Read all comments and provide any requested information Once all of this is done, please set the bug back to UNCONFIRMED and we will attempt to reproduce the issue. Please do not: a) respond via email b) update the version field in the bug or any of the other details on the top section of our bug tracker Warm Regards, QA Team MassPing-NeedInfo-FollowUp
Created attachment 184325 [details] Test case for Python called from formula function
I can confirm the behavior and have added a simplified test case. A python function taking no parameters and returning a string is called from A2 through this Basic wrapper: function callPython() oScriptProvider = ThisComponent.getScriptProvider() On Error goto ErrorExit: oScript = oScriptProvider.getScript("vnd.sun.star.script:formulaFunction.py$pythonFormulaFunction?language=Python&location=document") if IsNull(oScript) then callPython = "error getting python script: oScript is null" else callPython = oScript.invoke(array(), array(), array()) endif exit function ErrorExit: callPython = "error getting python script: " + chr(10)+chr(13) + Error$ End function When the document is opened, an error occurs. After recalc (Ctrl+Shift+F9) the function works without error The below function in B2 tries to track down the error a bit. It seems like the python function is not yet in the document storage when it is called the first time function findScript() ucb = CreateUnoService("com.sun.star.ucb.UniversalContentBroker", Array("Local", "Office")) identifier = ucb.createContentIdentifier("vnd.sun.star.tdoc:/1/Scripts/python/formulaFunction.py") content = ucb.queryContent(identifier) if IsNull(content) then findScript = "python script not found" else findScript = "python script found" endif End function The behavior is identical on AO 4.1.6 See also https://forum.openoffice.org//en/forum/viewtopic.php?p=532310#p532310
... still the same situation under 7.6.4.1 Win 10 64