]> granicus.if.org Git - python/commitdiff
Issue #28102: The zipfile module CLI now prints usage to stderr.
authorSerhiy Storchaka <storchaka@gmail.com>
Tue, 13 Sep 2016 06:26:29 +0000 (09:26 +0300)
committerSerhiy Storchaka <storchaka@gmail.com>
Tue, 13 Sep 2016 06:26:29 +0000 (09:26 +0300)
Patch by Stephen J. Turnbull.

Lib/zipfile.py
Misc/NEWS

index 7ba4e5980b8311cb91a21803ce5ca15c9ee67794..44e653d620b330302ec849f1f106a03ff3ced383 100644 (file)
@@ -1963,19 +1963,19 @@ def main(args = None):
         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 @@ def main(args = None):
 
     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 @@ def main(args = None):
 
     elif args[0] == '-c':
         if len(args) < 3:
-            print(USAGE)
+            print(USAGE, file=sys.stderr)
             sys.exit(1)
 
         def addToZip(zf, path, zippath):
index fe71b3511265bad474c1832cd22b94cf50eee5f6..aeccab418724774628ec2e0c53684cd31ca9aed5 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -13,6 +13,12 @@ Core and Builtins
 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
 =================================