Skip to Content
Menu
Dette spørgsmål er blevet anmeldt
2 Besvarelser
2735 Visninger

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
Kassér
Forfatter Bedste svar

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

Avatar
Kassér
Bedste svar

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
Kassér
Related Posts Besvarelser Visninger Aktivitet
0
maj 23
1514
1
sep. 22
3104
3
maj 23
6989
0
nov. 22
2121
0
okt. 22
2731