Message376731
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? |
|
Date |
User |
Action |
Args |
2020-09-11 13:41:46 | paul.moore | set | recipients:
+ paul.moore, brett.cannon, jaraco, ncoghlan, vstinner, eric.araujo, lukasz.langa, eric.snow, steve.dower, dstufft, pradyunsg, Marcus.Smith |
2020-09-11 13:41:46 | paul.moore | set | messageid: <1599831706.36.0.0400671680427.issue41490@roundup.psfhosted.org> |
2020-09-11 13:41:46 | paul.moore | link | issue41490 messages |
2020-09-11 13:41:46 | paul.moore | create | |
|