跳至內容
選單
此問題已被標幟
2 回覆
2591 瀏覽次數

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
1374
1
9月 22
2978
3
5月 23
6712
0
11月 22
2010
0
10月 22
2584