Siirry sisältöön
Menu
Sinun on rekisteröidyttävä, jotta voit olla vuorovaikutuksessa yhteisön kanssa.
Tämä kysymys on merkitty
2 Vastaukset
2656 Näkymät

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
Hylkää
Tekijä Paras vastaus

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

Avatar
Hylkää
Paras vastaus

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
Hylkää
Aiheeseen liittyviä artikkeleita Vastaukset Näkymät Toimenpide
0
toukok. 23
1459
1
syysk. 22
3044
3
toukok. 23
6812
0
marrask. 22
2076
0
lokak. 22
2637