Revision: 5772
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5772&view=rev
Author:   dsdale
Date:     2008-07-17 12:47:22 +0000 (Thu, 17 Jul 2008)

Log Message:
-----------
Merged revisions 5771 via svnmerge from 
https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_91_maint

........
  r5771 | dsdale | 2008-07-17 08:01:50 -0400 (Thu, 17 Jul 2008) | 2 lines
  
  improve error reporting in texmanager
........

Modified Paths:
--------------
    trunk/matplotlib/lib/matplotlib/texmanager.py

Property Changed:
----------------
    trunk/matplotlib/


Property changes on: trunk/matplotlib
___________________________________________________________________
Modified: svnmerge-integrated
   - /branches/v0_91_maint:1-5723
   + /branches/v0_91_maint:1-5771
Added: svn:mergeinfo
   + /branches/v0_91_maint:5753-5771

Modified: trunk/matplotlib/lib/matplotlib/texmanager.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/texmanager.py       2008-07-17 12:01:50 UTC 
(rev 5771)
+++ trunk/matplotlib/lib/matplotlib/texmanager.py       2008-07-17 12:47:22 UTC 
(rev 5772)
@@ -273,16 +273,22 @@
                             %(os.path.split(texfile)[-1], outfile))
             mpl.verbose.report(command, 'debug')
             exit_status = os.system(command)
-            fh = file(outfile)
+            try:
+                fh = file(outfile)
+                report = fh.read()
+                fh.close()
+            except IOError:
+                report = 'No latex error report available.'
             if exit_status:
                 raise RuntimeError(('LaTeX was not able to process the 
following \
-string:\n%s\nHere is the full report generated by LaTeX: \n\n'% repr(tex)) + 
fh.read())
-            else: mpl.verbose.report(fh.read(), 'debug')
-            fh.close()
+string:\n%s\nHere is the full report generated by LaTeX: \n\n'% repr(tex)) + 
report)
+            else: mpl.verbose.report(report, 'debug')
             for fname in glob.glob(basefile+'*'):
                 if fname.endswith('dvi'): pass
                 elif fname.endswith('tex'): pass
-                else: os.remove(fname)
+                else:
+                    try: os.remove(fname)
+                    except OSError: pass
 
         return dvifile
 
@@ -305,14 +311,19 @@
                         os.path.split(dvifile)[-1], outfile))
             mpl.verbose.report(command, 'debug')
             exit_status = os.system(command)
-            fh = file(outfile)
+            try:
+                fh = file(outfile)
+                report = fh.read()
+                fh.close()
+            except IOError:
+                report = 'No dvipng error report available.'
             if exit_status:
                 raise RuntimeError('dvipng was not able to \
 process the flowing file:\n%s\nHere is the full report generated by dvipng: \
-\n\n'% dvifile + fh.read())
-            else: mpl.verbose.report(fh.read(), 'debug')
-            fh.close()
-            os.remove(outfile)
+\n\n'% dvifile + report)
+            else: mpl.verbose.report(report, 'debug')
+            try: os.remove(outfile)
+            except OSError: pass
 
         return pngfile
 


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to