PermissionError: [Errno 13] Permission denied: 遇到问题的解决方法

 

python文件运行过程中遇到如下问题:

D:\software\python\python.exe C:/Users/dingy/PycharmProjects/LaoXinDai/laoxindaijiekou/jichujiekou/excelfile3.py
2020-12-07 16:17:15,759 - excelfile3 - INFO - save file name:C:\Users\dingy\PycharmProjects\LaoXinDai\laoxindaijiekou\TestData\new_jinjian.xlsx
Traceback (most recent call last):
  File "C:/Users/dingy/PycharmProjects/LaoXinDai/laoxindaijiekou/jichujiekou/excelfile3.py", line 159, in
    read_filename=Ex.update_excel(write_filename)
  File "C:/Users/dingy/PycharmProjects/LaoXinDai/laoxindaijiekou/jichujiekou/excelfile3.py", line 42, in update_excel
    newWb.save(new_filename)  # 保存至新文件路径
  File "D:\software\python\lib\site-packages\xlwt\Workbook.py", line 710, in save
    doc.save(filename_or_stream, self.get_biff_data())
  File "D:\software\python\lib\site-packages\xlwt\CompoundDoc.py", line 262, in save
    f = open(file_name_or_filelike_obj, 'w+b')
PermissionError: [Errno 13] Permission denied: 'C:\\Users\\dingy\\PycharmProjects\\LaoXinDai\\laoxindaijiekou\\TestData\\new_jinjian.xlsx'

Process finished with exit code 1
遇到红色字体问题,说明此时excel文件正打开,不能写入内容。将文件关闭,再重新运行python文件就可以了

你可能感兴趣的:(python,python,excel)