Skip to Content
Menu
This question has been flagged
2 Replies
2805 Rodiniai

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


Portretas
Atmesti
Autorius Best Answer

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

Portretas
Atmesti
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

Portretas
Atmesti
Related Posts Replies Rodiniai Veikla
0
geg. 23
1538
1
rugs. 22
3186
3
geg. 23
7098
0
lapkr. 22
2158
0
spal. 22
2803