Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
2 Ответы
2643 Представления

Hey

I am trying to implement safe_eval to calculate some formulas but when I try to "import math" it gives me an error  


safe_eval('aoc = math.pi * (radius**2)',{'radius': 3},mode='exec',nocopy= True)
Any suggestions would be greatly appreciated

Thanks


Аватар
Отменить
Автор Лучший ответ

I  blacklisted the import function somewhere in tools.py and now I can import math function

Аватар
Отменить
Лучший ответ

Hi,
Can you try importing the library “from odoo.tools.safe_eval import safe_eval” instead of using math library and then use the function safe_eval

Аватар
Отменить
Related Posts Ответы Просмотры Активность
0
мая 23
1456
1
сент. 22
3038
3
мая 23
6802
0
нояб. 22
2072
0
окт. 22
2629