cel-python
cel-python copied to clipboard
Example from README do not work for prg.evaluate function
Example from README do not work for prg.evaluate function
import celpy
from celpy import CELEvalError
env = celpy.Environment()
# Press the green button in the gutter to run the script.
if __name__ == '__main__':
all_positive = "data.all(x, x>0)"
breaks = {'data': [1, 2, 3] }
ast = env.compile(all_positive)
prgm = env.program(ast)
prgm.evaluate(breaks)
.venv/lib/python3.13/site-packages/celpy/evaluation.py", line 1461, in relation
}[left_op.data]
^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'data'
python -V
Python 3.13.0
Solution is to use python 3.12 o lower
I added import sys; print(sys.version_info) to the demo code shown above.
Using Python 3.13.0 environment at: issue80
Resolved 8 packages in 790ms
Built cel-python @ file:///Users/slott/github/local/cel-python
Prepared 5 packages in 258ms
Installed 8 packages in 9ms
+ cel-python==0.2.0 (from file:///Users/slott/github/local/cel-python)
+ lark==0.12.0
+ pendulum==3.1.0
+ python-dateutil==2.9.0.post0
+ pyyaml==6.0.2
+ six==1.17.0
+ types-pyyaml==6.0.12.20250516
+ tzdata==2025.2
(issue80) slott@MacBook-Pro-M4 CELPython % python ~/github/local/cel-python/demo/issue_80.py
sys.version_info(major=3, minor=13, micro=0, releaselevel='final', serial=0)
Using the contents of the current main branch, I cannot reproduce the problem. I suspect this is fixed in main, and the next release should resolve this issue.