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 <rep...@bugs.python.org> <http://bugs.python.org/issue6839> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com