problem using pyeval_expression - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: problem using pyeval_expression (/thread-41017.html) |
problem using pyeval_expression - akbarza - Oct-30-2023 hi i found the below code in a net page( i do not know the exact address of it): from pyeval_expression import Expression expr=Expression(" 53 * -4 +2 * 3 ") print(expr.result())after running the code in idle, the below error appeared: then in cmd, I wrote:C:\WINDOWS\system32>pip install pyeval_expression and the result is: My Python version is Python 3.11.5 .what can I do to fix the problem? thanks RE: problem using pyeval_expression - deanhystad - Oct-30-2023 I search for pyeval_expression and find nothing. Where did you find a reference to this thing? RE: problem using pyeval_expression - snippsat - Oct-30-2023 Code is not publish on PyPi,code is just a repo on GitHub. Usage: G:\div_code λ git clone https://github.com/JFincher42/PyEval.git Cloning into 'PyEval'... remote: Enumerating objects: 44, done. remote: Total 44 (delta 0), reused 0 (delta 0), pack-reused 44 Receiving objects: 100% (44/44), 9.38 KiB | 3.13 MiB/s, done. Resolving deltas: 100% (16/16), done. G:\div_code λ cd PyEval\ G:\div_code\PyEval (master -> origin) λ ls debug-example.py expr_test.py Pipfile pyeval_expression.py pyeval_operand.py pyeval_operator.py ev_test.py G:\div_code\PyEval (master -> origin) λ python ev_test.py 53 -4 * 2 3 * + G:\div_code\PyEval (master -> origin) λ cat ev_test.py from pyeval_expression import Expression expr=Expression(" 53 * -4 +2 * 3 ") print(expr.result()) RE: problem using pyeval_expression - popejose - Oct-30-2023 Maybe this one? Name is similar but not exact. On PyPi. pip install py-expression-eval /regards RE: problem using pyeval_expression - akbarza - Oct-31-2023 (Oct-30-2023, 02:30 PM)popejose Wrote: Maybe this one? Name is similar but not exact. hi I used cmd for the command: pip install py-expression-eval and then I changed the code to: from py_expression_eval import Expression expr=Expression(" 53 * -4 +2 * 3 ") print(expr.result())but the below error was shown:
RE: problem using pyeval_expression - snippsat - Oct-31-2023 (Oct-31-2023, 10:57 AM)akbarza Wrote: I used cmd for the command: pip install py-expression-evalThen you most follow the Doc py-expression-eval. >>> from py_expression_eval import Parser >>> >>> parser = Parser() >>> p = parser.parse('53 * (-4) +2 * 3') >>> p.evaluate({}) -206Or Simpleeval. >>> from simpleeval import simple_eval >>> >>> simple_eval(" 53 * -4 +2 * 3 ") -206 |