Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File ".../venv/lib/python3.11/site-packages/jsonata/jsonata.py", line 2048, in evaluate
raise err
File ".../venv/lib/python3.11/site-packages/jsonata/jsonata.py", line 2038, in evaluate
it = self.eval(self.ast, input, exec_env)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File ".../venv/lib/python3.11/site-packages/jsonata/jsonata.py", line 243, in eval
return _this._eval(expr, input, environment)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File ".../venv/lib/python3.11/site-packages/jsonata/jsonata.py", line 291, in _eval
result = self.evaluate_function(expr, input, environment, utils.Utils.NONE)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File ".../venv/lib/python3.11/site-packages/jsonata/jsonata.py", line 1409, in evaluate_function
raise err
File ".../venv/lib/python3.11/site-packages/jsonata/jsonata.py", line 1399, in evaluate_function
result = self.apply(proc, evaluated_args, input, environment)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File ".../venv/lib/python3.11/site-packages/jsonata/jsonata.py", line 1422, in apply
result = self.apply_inner(proc, args, input, environment)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File ".../venv/lib/python3.11/site-packages/jsonata/jsonata.py", line 1454, in apply_inner
validated_args = self.validate_arguments(proc, args, input)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File ".../venv/lib/python3.11/site-packages/jsonata/jsonata.py", line 1601, in validate_arguments
validated_args = signature.validate(args, context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File ".../venv/lib/python3.11/site-packages/jsonata/jsonata.py", line 135, in validate
return self.signature.validate(args, context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File ".../venv/lib/python3.11/site-packages/jsonata/signature.py", line 301, in validate
raise jexception.JException("T0412", -1, arg, param.subtype)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File ".../venv/lib/python3.11/site-packages/jsonata/jexception.py", line 39, in __init__
super().__init__(JException.msg(error, location, current_token, expected))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File ".../venv/lib/python3.11/site-packages/jsonata/jexception.py", line 114, in msg
formatted = formatted.format(arg1, arg2)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
IndexError: Replacement index 2 out of range for positional args tuple
However, the formatter is hard coded to only handle up to two arguments. A visual scan of the error messages defined in jsonata/jexception.py suggests this might also be a problem for T2009; indeed, I can reproduce a similar error with the JSONata expression "foo" > 3.
This is tested against version 0.7.0 of
jsonata-python, Python 3.11.15 on MacOS.Reproduce:
Traceback:
Notes:
It looks like the error message for T0412 has three arguments:
jsonata-python/src/jsonata/jexception.py
Line 168 in 8b9ad13
However, the formatter is hard coded to only handle up to two arguments. A visual scan of the error messages defined in
jsonata/jexception.pysuggests this might also be a problem for T2009; indeed, I can reproduce a similar error with the JSONata expression"foo" > 3.