콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
2 답글
2891 화면

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
1602
1
9월 22
3242
3
5월 23
7200
0
11월 22
2176
0
10월 22
2860