This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

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 <>
I think this reproduces the underlying issue:

>>> import zipfile
>>> from pathlib import Path
>>> p = zipfile.Path("")
>>> Path("").unlink()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\UK03306\AppData\Local\Programs\Python\Python38\lib\", line 1321, in unlink
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: ''

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?
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: <>
2020-09-11 13:41:46paul.moorelinkissue41490 messages
2020-09-11 13:41:46paul.moorecreate