Hi ironpython,

Here's your Daily Digest of new issues for project "IronPython".

In today's digest:ISSUES

1. [New issue] Unclosed file handles after execution of ZipFile.extractall 
method

----------------------------------------------

ISSUES

1. [New issue] Unclosed file handles after execution of ZipFile.extractall 
method
http://ironpython.codeplex.com/workitem/33571
User constantineiv has proposed the issue:

"After extracting some zip archive by zipfile.ZipFile.extractall method there 
are sometimes unclosed handles to archive file (after execution under context 
manager or after explict archive closing by close method). These open handles 
prevent later deletion of archive zip file.

This issue manifested only in IronPython, never noticed in CPython.

Please consider following code run in IPy 2.7.3 and Win7 (also tested in IPy 
2.7.1 and Win2003):

--------------------------------------------
import zipfile
import subprocess

archive_path = r'c:\dir\archive.zip'
unpack_path = r'c:\dir\unpacked'
handle_tool_path = r'c:\dir\handle.exe'

def print_archive_handles(archive_path):
    p = subprocess.Popen([handle_tool_path, archive_path],
                         stdout=subprocess.PIPE,
                         stderr=subprocess.STDOUT)
    stdout, stderr = p.communicate()
    print stdout

with zipfile.ZipFile(archive_path) as z:
    z.extractall(unpack_path)

print_archive_handles(archive_path)
--------------------------------------------

Print output is:

Handle v3.46
Copyright (C) 1997-2011 Mark Russinovich
Sysinternals - www.sysinternals.com

ipy.exe            pid: 7944   type: File           620: C:\dir\archive.zip



As seen in above output of handle.exe tool (downloadable from 
http://technet.microsoft.com/en-US/sysinternals), there is an open handle to 
archive file even after an archive is closed in context manager."
----------------------------------------------



----------------------------------------------
You are receiving this email because you subscribed to notifications on 
CodePlex.

To report a bug, request a feature, or add a comment, visit IronPython Issue 
Tracker. You can unsubscribe or change your issue notification settings on 
CodePlex.com.
_______________________________________________
Ironpython-users mailing list
Ironpython-users@python.org
http://mail.python.org/mailman/listinfo/ironpython-users

Reply via email to