[Python-checkins] cpython: Issue #28102: The zipfile module CLI now prints usage to stderr.

serhiy.storchaka python-checkins at python.org
Tue Sep 13 02:26:57 EDT 2016


https://hg.python.org/cpython/rev/5e2780908857
changeset:   103744:5e2780908857
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Tue Sep 13 09:26:29 2016 +0300
summary:
  Issue #28102: The zipfile module CLI now prints usage to stderr.
Patch by Stephen J. Turnbull.

files:
  Lib/zipfile.py |  10 +++++-----
  Misc/NEWS      |   6 ++++++
  2 files changed, 11 insertions(+), 5 deletions(-)


diff --git a/Lib/zipfile.py b/Lib/zipfile.py
--- a/Lib/zipfile.py
+++ b/Lib/zipfile.py
@@ -1963,19 +1963,19 @@
         args = sys.argv[1:]
 
     if not args or args[0] not in ('-l', '-c', '-e', '-t'):
-        print(USAGE)
+        print(USAGE, file=sys.stderr)
         sys.exit(1)
 
     if args[0] == '-l':
         if len(args) != 2:
-            print(USAGE)
+            print(USAGE, file=sys.stderr)
             sys.exit(1)
         with ZipFile(args[1], 'r') as zf:
             zf.printdir()
 
     elif args[0] == '-t':
         if len(args) != 2:
-            print(USAGE)
+            print(USAGE, file=sys.stderr)
             sys.exit(1)
         with ZipFile(args[1], 'r') as zf:
             badfile = zf.testzip()
@@ -1985,7 +1985,7 @@
 
     elif args[0] == '-e':
         if len(args) != 3:
-            print(USAGE)
+            print(USAGE, file=sys.stderr)
             sys.exit(1)
 
         with ZipFile(args[1], 'r') as zf:
@@ -1993,7 +1993,7 @@
 
     elif args[0] == '-c':
         if len(args) < 3:
-            print(USAGE)
+            print(USAGE, file=sys.stderr)
             sys.exit(1)
 
         def addToZip(zf, path, zippath):
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -13,6 +13,12 @@
 Library
 -------
 
+Tools/Demos
+-----------
+
+- Issue #28102: The zipfile module CLI now prints usage to stderr.
+  Patch by Stephen J. Turnbull.
+
 
 What's New in Python 3.6.0 beta 1
 =================================

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list