我有这段代码来创建一个.xls文件来存储python数据。当我在服务器或本地中运行它时,出现此错误: PermissionError:[Errno 13]权限被拒绝:“ Payment Report.xls”
file.close()
row += 2
date = datetime.now()
name = ('Payroll Payment Report_'+ str(date)+'.xls')
filename = ('Payment Report.xls')
workbook.save(filename)
file = open(filename, "rb")
file_data = file.read()
out = base64.encodestring(file_data)
self.write({'file_name': out, 'filexcel': name})
return {
'type': 'ir.actions.act_window',
'res_model': 'payslip.hr.payment.xls',
'view_mode': 'form',
'view_type': 'form',
'res_id': self.id,
'target': 'new', }