From: <md...@us...> - 2009-09-21 12:07:46
|
Revision: 7806 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7806&view=rev Author: mdboom Date: 2009-09-21 12:07:39 +0000 (Mon, 21 Sep 2009) Log Message: ----------- Don't crash the plot_directive if the plot itself fails. Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/sphinxext/plot_directive.py Modified: trunk/matplotlib/lib/matplotlib/sphinxext/plot_directive.py =================================================================== --- trunk/matplotlib/lib/matplotlib/sphinxext/plot_directive.py 2009-09-21 12:07:15 UTC (rev 7805) +++ trunk/matplotlib/lib/matplotlib/sphinxext/plot_directive.py 2009-09-21 12:07:39 UTC (rev 7806) @@ -170,6 +170,7 @@ stdout = sys.stdout sys.stdout = cStringIO.StringIO() os.chdir(path) + fd = None try: fd = open(fname) module = imp.load_module( @@ -178,7 +179,8 @@ del sys.path[0] os.chdir(pwd) sys.stdout = stdout - fd.close() + if fd is not None: + fd.close() if function_name is not None: getattr(module, function_name)() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |