[Python-checkins] r68330 - peps/trunk/genpepindex.py

benjamin.peterson python-checkins at python.org
Mon Jan 5 02:12:53 CET 2009


Author: benjamin.peterson
Date: Mon Jan  5 02:12:53 2009
New Revision: 68330

Log:
output an nice error message instead of tracebacking

Modified:
   peps/trunk/genpepindex.py

Modified: peps/trunk/genpepindex.py
==============================================================================
--- peps/trunk/genpepindex.py	(original)
+++ peps/trunk/genpepindex.py	Mon Jan  5 02:12:53 2009
@@ -23,7 +23,7 @@
 from operator import attrgetter
 
 from pep0.output import write_pep0
-from pep0.pep import PEP
+from pep0.pep import PEP, PEPError
 
 
 def main(argv):
@@ -40,7 +40,13 @@
                 continue
             if file_path.startswith("pep-") and file_path.endswith(".txt"):
                 with codecs.open(abs_file_path, 'r', encoding='UTF-8') as pep_file:
-                    peps.append(PEP(pep_file))
+                    try:
+                        peps.append(PEP(pep_file))
+                    except PEPError, e:
+                        errmsg = "Error processing PEP %s, excluding:" % \
+                            (e.number,)
+                        print >>sys.stderr, errmsg, e
+                        sys.exit(1)
         peps.sort(key=attrgetter('number'))
     elif os.path.isfile(path):
         with open(path, 'r') as pep_file:


More information about the Python-checkins mailing list