Paul Moore <p.f.mo...@gmail.com> added the comment:
I think this reproduces the underlying issue: >>> import zipfile >>> from pathlib import Path >>> p = zipfile.Path("tst.zip") >>> Path("tst.zip").unlink() Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C:\Users\UK03306\AppData\Local\Programs\Python\Python38\lib\pathlib.py", line 1321, in unlink self._accessor.unlink(self) PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'tst.zip' >>> Basically, zipfile.Path objects don't have any way to close the underlying zipfile, so you have to delete the path object to free up the file for deletion. In the context of importlib, maybe permanently holding a reference to the zipfile.Path object can't work, and it needs to be re-opened each time it's needed? ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue41490> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com