Author paul.moore
Recipients Marcus.Smith, brett.cannon, dstufft, eric.araujo, eric.snow, jaraco, lukasz.langa, ncoghlan, paul.moore, pradyunsg, steve.dower, vstinner
Date 2020-09-11.13:41:46
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1599831706.36.0.0400671680427.issue41490@roundup.psfhosted.org>
In-reply-to
Content
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?
History
Date User Action Args
2020-09-11 13:41:46paul.mooresetrecipients: + paul.moore, brett.cannon, jaraco, ncoghlan, vstinner, eric.araujo, lukasz.langa, eric.snow, steve.dower, dstufft, pradyunsg, Marcus.Smith
2020-09-11 13:41:46paul.mooresetmessageid: <1599831706.36.0.0400671680427.issue41490@roundup.psfhosted.org>
2020-09-11 13:41:46paul.moorelinkissue41490 messages
2020-09-11 13:41:46paul.moorecreate