From db7a063d763135e08069b30fb5c4a292d39de987 Mon Sep 17 00:00:00 2001 From: Tony S Yu Date: Sat, 2 Mar 2013 17:21:14 -0600 Subject: [PATCH] ENH: If example fails, print traceback and carry on. --- doc/ext/plot2rst.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/doc/ext/plot2rst.py b/doc/ext/plot2rst.py index 65c77521..00560be4 100644 --- a/doc/ext/plot2rst.py +++ b/doc/ext/plot2rst.py @@ -69,6 +69,7 @@ import os import shutil import token import tokenize +import traceback import numpy as np import matplotlib @@ -247,7 +248,16 @@ def write_gallery(gallery_index, src_dir, rst_dir, cfg, depth=0): gallery_index.write(TOCTREE_TEMPLATE % (sub_dir + '\n '.join(ex_names))) for src_name in examples: - write_example(src_name, src_dir, rst_dir, cfg) + + try: + write_example(src_name, src_dir, rst_dir, cfg) + except Exception: + print "Exception raised while running:" + print "%s in %s" % (src_name, src_dir) + print '~' * 60 + traceback.print_exc() + print '~' * 60 + continue link_name = sub_dir.pjoin(src_name) link_name = link_name.replace(os.path.sep, '_')