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.

Title: ZipExtFile object close without file handle closed
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 2.7
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: V.E.O, alanmcintyre, jcea, loewis, python-dev
Priority: normal Keywords:

Created on 2012-10-10 08:59 by V.E.O, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (3)
msg172555 - (view) Author: V.E.O (V.E.O) Date: 2012-10-10 08:59
Hi, I tried to open file-like object ZipExtFile in one zip file, after operations, I close it and after all, close ZipFile.
But I still can not remove the zip file immediately.

This problem happens on Windows, error msg:
WindowsError: [Error 32] The process cannot access the file because it is being used by another process: ......

Sample code as below:

z = ZipFile('D:\\1', 'r')
zlist = z.infolist()
for zi in zlist:
    zf =

msg174732 - (view) Author: Jesús Cea Avión (jcea) * (Python committer) Date: 2012-11-04 01:14
This bug was solved in python 3.2. Pyhton 3.1 is affected.

This is not a windows issue: the file reference is kept in all platforms.

This seems to be solved in 2c370065c1b4 and 260ff379115c.

See issue #9846.
msg174737 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012-11-04 01:33
New changeset 6a14f692df1c by Jesus Cea in branch '2.7':
Closes #16183: ZipExtFile object close without file handle closed (backporting of Issue #9846)
Date User Action Args
2022-04-11 14:57:37adminsetgithub: 60387
2012-11-04 11:11:56serhiy.storchakasetcomponents: - Windows
2012-11-04 01:33:45python-devsetstatus: open -> closed

nosy: + python-dev
messages: + msg174737

resolution: fixed
stage: resolved
2012-11-04 01:14:15jceasetnosy: + jcea
messages: + msg174732
2012-10-10 10:18:17serhiy.storchakasetnosy: + loewis, alanmcintyre
components: + Windows
2012-10-10 08:59:29V.E.Osettype: behavior
2012-10-10 08:59:12V.E.Ocreate