Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
2 Odpowiedzi
2655 Widoki

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


Awatar
Odrzuć
Autor Najlepsza odpowiedź

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

Awatar
Odrzuć
Najlepsza odpowiedź

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

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
0
maj 23
1459
1
wrz 22
3044
3
maj 23
6812
0
lis 22
2075
0
paź 22
2637