[issue22046] ZipFile.read() should mention that it might throw NotImplementedError
New submission from Jason Heeris: As per issue 5701, the zipfile.ZipFile.read() method will throw a NotImplementedError if the compression scheme is not supported. However, there is no mention of this possibility in the documentation for the read() method. I would suggest, say, "Calling read() on a ZipFile that uses an unsupported compression scheme (eg. implode) will raise a NotImplementedError." It looks like you can use the testzip() method to check that this won't happen (ie. after you open the file but before you extract an entry). If that is really the expected way to check for this kind of condition, it would be nice to mention that too (under either method). -- assignee: docs@python components: Documentation messages: 223737 nosy: detly, docs@python priority: normal severity: normal status: open title: ZipFile.read() should mention that it might throw NotImplementedError type: enhancement versions: Python 2.7, Python 3.3 ___ Python tracker <http://bugs.python.org/issue22046> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22046] ZipFile.read() should mention that it might throw NotImplementedError
Jason Heeris added the comment: @Ezio I am pretty sure it was read(). I couldn't submit the file I used as an example, so I'll see if I can construct a minimal example to post here. -- ___ Python tracker <http://bugs.python.org/issue22046> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22046] ZipFile.read() should mention that it might throw NotImplementedError
Changes by Jason Heeris : Added file: http://bugs.python.org/file36279/Scheme.zip ___ Python tracker <http://bugs.python.org/issue22046> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22046] ZipFile.read() should mention that it might throw NotImplementedError
Changes by Jason Heeris : Added file: http://bugs.python.org/file36280/zftest.py ___ Python tracker <http://bugs.python.org/issue22046> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22046] ZipFile.read() should mention that it might throw NotImplementedError
Jason Heeris added the comment: Okay, I've attached two files: 1. Scheme.zip, from issue 5701 2. "zftest.py", a script that you run in the same dir as "Scheme.zip" to produce this: $ python zftest.py Extracting: 1!SCHEME.Z64 Traceback (most recent call last): File "zftest.py", line 8, in child_data = parent.read(zinfo) File "/usr/lib/python2.7/zipfile.py", line 931, in read return self.open(name, "r", pwd).read() File "/usr/lib/python2.7/zipfile.py", line 1006, in open close_fileobj=should_close) File "/usr/lib/python2.7/zipfile.py", line 530, in __init__ raise NotImplementedError("compression type %d (%s)" % (self._compress_type, descr)) NotImplementedError: compression type 6 (implode) -- ___ Python tracker <http://bugs.python.org/issue22046> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22046] ZipFile.read() should mention that it might throw NotImplementedError
Jason Heeris added the comment: Sorry, that was run with Python 2.7.5+ on Ubuntu. -- ___ Python tracker <http://bugs.python.org/issue22046> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22046] ZipFile.read() should mention that it might throw NotImplementedError
Jason Heeris added the comment: > Python documentation never document all possible exceptions raised by a > method. No, but clearly *some* exceptions are documented, and presumably there's some reasoning behind which are and aren't. In this case, the NotImplemented error is there by design. It's not an incidental effect of something else. It's part of the API, and it's used to indicate a common error condition: that the compression format is not supported. -- ___ Python tracker <http://bugs.python.org/issue22046> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com