Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
2 Răspunsuri
2660 Vizualizări

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


Imagine profil
Abandonează
Autor Cel mai bun răspuns

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

Imagine profil
Abandonează
Cel mai bun răspuns

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

Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
0
mai 23
1461
1
sept. 22
3045
3
mai 23
6812
0
nov. 22
2078
0
oct. 22
2640