[New-bugs-announce] [issue10631] ZipFile and current directory change

Hirokazu Yamamoto report at bugs.python.org
Sun Dec 5 17:49:21 CET 2010


New submission from Hirokazu Yamamoto <ocean-city at m2.ccsnet.ne.jp>:

Is this intended behavior? Creating zipfile.ZipFile with
relative path and changing current directory, relative path
is resolved from new directory not from the directory object
was created.

F:\>py3k
Python 3.2a4+ (py3k, Dec  3 2010, 22:11:05) [MSC v.1200 32 bit (Intel)] on win32

Type "help", "copyright", "credits" or "license" for more information.
>>> import zipfile
[67577 refs]
>>> zip = zipfile.ZipFile("non-ascii-cp932.zip", "r")
[68999 refs]
>>> import os
[69001 refs]
>>> os.mkdir("temp")
[69001 refs]
>>> os.chdir("temp")
[69001 refs]
>>> zip.extractall()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "e:\python-dev\py3k\lib\zipfile.py", line 992, in extractall
    self.extract(zipinfo, path, pwd)
  File "e:\python-dev\py3k\lib\zipfile.py", line 980, in extract
    return self._extract_member(member, path, pwd)
  File "e:\python-dev\py3k\lib\zipfile.py", line 1023, in _extract_member
    source = self.open(member, pwd=pwd)
  File "e:\python-dev\py3k\lib\zipfile.py", line 901, in open
    zef_file = io.open(self.filename, 'rb')
IOError: [Errno 2] No such file or directory: 'non-ascii-cp932.zip'
[69128 refs]

----------
messages: 123428
nosy: ocean-city
priority: normal
severity: normal
status: open
title: ZipFile and current directory change
type: behavior

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10631>
_______________________________________


More information about the New-bugs-announce mailing list