Open tillschumann opened 6 years ago
I have the same issue and my workaround so far has been to multiply by the inverse. So instead of A / 80
, I do A * 0.0125
, because 1/80=0.0125.
However this will also result in a parse error, when both sides are just numberic values, as in 2 * 0.0125
.
Same issue, my workaround is to change the regex used in t_SORT_DIRECTION. It probably breaks features using t_SORT_DIRECTION.
from jsonpath_ng.ext import parse
from jsonpath_ng.ext.parser import ExtendedJsonPathLexer
ExtendedJsonPathLexer.t_SORT_DIRECTION.__doc__ = r',?\s*(//|\\)' # replace r',?\s*(/|\\)' by r',?\s*(//|\\)'
jsonpath_expr = parse('$.A / 80', debug=True)
jsonpath_expr.find({'A': 160})
[DatumInContext(value=2.0, path=This(), context=None)]
Hi, Great Library! But unfortunately, I get an error trying to use the division operator.
Example:
Am I using it wrong? I tried to debug the code, but I couldn't figure out why it does not work.
Thanks a lot for any hints! Best, Till