fumitoh / modelx

Use Python like a spreadsheet!
https://modelx.io
GNU Lesser General Public License v3.0
90 stars 20 forks source link

Error log contains only function name, not arguments, with which it was called #16

Closed alebaran closed 4 years ago

alebaran commented 4 years ago

When for some reason the value of the cell can't be evaluated, the error log contains only function name, not arguments, with which it was called. E.g.:

Traceback (most recent call last):
  File "<string>", line 3, in CF_discounted_df
  File "...\Anaconda3\lib\site-packages\pandas\core\indexing.py", line 204, in __setitem__
    indexer = self._get_setitem_indexer(key)

It would really be helpful for troubleshooting to see the arguments with which function CF_discounted_df was called.

alebaran commented 4 years ago

It would also help to see the space, which contains the cell. Thank you!

alebaran commented 4 years ago

And on more thing :-) It would be extremely helpful to see the code in the line, which broke.

alebaran commented 4 years ago
fumitoh commented 4 years ago

v0.6.0 should meet this request. https://modelx.readthedocs.io/en/latest/releases/relnotes_v0_6_0.html

alexeybaran commented 4 years ago

Thank you for this development. Unfortunately it breaks in case function is used within the cell:

from modelx import *
m, s = new_model(), new_space()
@defcells
def a(t):
    if t > 0:
        return sum([a(t - i) for i in range(1, 2)])
    else:
        raise ValueError()

a(1)