https://bugs.documentfoundation.org/show_bug.cgi?id=151603

--- Comment #12 from Paul Smith <[email protected]> ---
Thanks, Rafael, for your message!

I have just tried the following script both from inside Calc and from a Python
console. In Calc, I get the reported error all the same. However, in the Python
console, no error at all.

---------------------------------------
[x@localhost python]$ pwd
/home/x/.config/libreoffice/4/user/Scripts/python
[x@localhost python]$ python
Python 3.10.7 (main, Sep  7 2022, 00:00:00) [GCC 12.2.1 20220819 (Red Hat
12.2.1-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import uno
>>> import numpy as np
>>> from rpy2.robjects.packages import importr, data
>>> rpart = importr('rpart')
>>> datasets = importr('datasets')
>>> base = importr('base')
>>> 
>>> def acertos_iris(args=None):
...     iris = data(datasets).fetch('iris')['iris']
...     model = rpart.rpart('Species ~ .', iris)
...     preds = rpart.predict_rpart(model, iris, type='class') 
...     nacertos = base.sum(base.diag(base.table(preds, iris.rx2(5))))
...     erro = nacertos[0]/150
...     doc = XSCRIPTCONTEXT.getDocument()
...     sheet = doc.CurrentController.ActiveSheet
...     cell = sheet.getCellByPosition(0, 0)
...     cell.setValue(erro)
...     doc.setArray("~.A1", erro)
... 
>>> 
---------------------------------------

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to