os.remove-[winerror 32]进程无法访问该文件,因为另一个进程正在使用它

yebdmbv4  于 2021-07-13  发布在  Java
关注(0)|答案(0)|浏览(185)

如果我把它作为一个单独的模块运行,它可以正常工作,但是当我在另一个py文件中将它作为一个方法调用时,它会在第二次循环后停止并抛出以下错误:

for rownum in range(1, ws_read_execution_report_max_rows):
    shutil.copy(pdf_file_path, pdf_archive_path)
    if os.path.isfile(pdf_file_path):
        os.remove(pdf_file_path)

引发异常:

[WinError 32] The process cannot access the file because it is being used by another process

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题