コンテンツへスキップ
メニュー
この質問にフラグが付けられました
2 返信
2804 ビュー

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


アバター
破棄
著作者 最善の回答

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

アバター
破棄
最善の回答

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

アバター
破棄
関連投稿 返信 ビュー 活動
0
5月 23
1538
1
9月 22
3186
3
5月 23
7098
0
11月 22
2158
0
10月 22
2803