[issue6839] zipfile can't extract file

Gregory P. Smith report at bugs.python.org
Wed Apr 30 09:23:25 CEST 2014


Gregory P. Smith added the comment:

Don't use print (to stdout) or sys.stderr directly.  There are already many other uses of warnings.warn within the zipfile module.  Be consistent with those.

Existing zipfile warnings seem to favor lazily importing warnings when its needed rather than a top level 'import warnings'.  While I find that annoying, there are sometimes reasons to do it and the minimally invasive change that is consistent with the rest of the existing code is to do the same thing here.

something similar to:

+            if self.debug and fname != zinfo.orig_filename:
+                import warnings
+                warnings.warn(
+                        'Warning: Filename in directory "%s" and header "%s" differ.' % (
+                            zinfo.orig_filename, fname))

----------
nosy: +gregory.p.smith

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


More information about the Python-bugs-list mailing list