[Zope3-checkins] SVN: Zope3/trunk/src/zope/dependencytool/finddeps.py handle some common exceptions more cleanly

Fred L. Drake, Jr. fred at zope.com
Thu May 27 13:14:09 EDT 2004


Log message for revision 25055:
handle some common exceptions more cleanly


-=-
Modified: Zope3/trunk/src/zope/dependencytool/finddeps.py
===================================================================
--- Zope3/trunk/src/zope/dependencytool/finddeps.py	2004-05-27 16:55:33 UTC (rev 25054)
+++ Zope3/trunk/src/zope/dependencytool/finddeps.py	2004-05-27 17:14:09 UTC (rev 25055)
@@ -44,10 +44,11 @@
 
 $Id$
 """
-import sys
+import errno
 import getopt
 import os
 import re
+import sys
 
 import zope
 
@@ -323,8 +324,16 @@
 
 
 def main(argv=None):
-    if argv is None:
-        argv = sys.argv
-    options = parse_args(argv)
-    showDependencies(options.path, options.zcml, options.long,
-                     options.all, options.packages)
+    try:
+        if argv is None:
+            argv = sys.argv
+        options = parse_args(argv)
+        showDependencies(options.path, options.zcml, options.long,
+                         options.all, options.packages)
+    except IOError, e:
+        # Ignore EPIPE since that really only indicates some
+        # application on the other end of piped output exited early.
+        if e.errno != errno.EPIPE:
+            raise
+    except KeyboardInterrupt:
+        sys.exit(1)




More information about the Zope3-Checkins mailing list