Skip to Content
Menu
You need to be registered to interact with the community.
This question has been flagged
2 Odgovori
2628 Prikazi

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


Avatar
Opusti
Avtor Best Answer

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

Avatar
Opusti
Best Answer

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

Avatar
Opusti
Related Posts Odgovori Prikazi Aktivnost
0
maj 23
1441
1
sep. 22
3023
3
maj 23
6788
0
nov. 22
2058
0
okt. 22
2621