python 检测文件夹是否存在的不易发现错误
file_path = os.path.join(os.getcwd(), 'tempdata', mb.name) # datas_fname
print(file_path,mb.name)
if os.path.exists(os.path.join(os.getcwd(), 'tempdata')):
raise ValidationError(_("请在服务器配置报告文件夹tempdata!"))
file = open(file_path, 'wb+')
file.write(datas)
file.close()
[Errno 2] No such file or directory: 'G:\od15bdfwq\tempdata\bg'
2022-06-10 07:11:39,052 8568 ERROR wsp_xzd006 odoo.http: Exception during JSON request handling.
Traceback (most recent call last):
File "G:od15bdfwqodooaddonsbasemodelsir_http.py", line 237, in _dispatch
result = request.dispatch()
File "G:od15bdfwqodoohttp.py", line 694, in dispatch
result = self._call_function(**self.params)
File "G:od15bdfwqodoohttp.py", line 365, in _call_function
return checked_call(self.db, *args, **kwargs)
F



