Benoît Allard  committed c61d128

graphviz: also catch IOError with Errno 22 (invalid parameter)

This happen on Python2.7 and Graphviz version 2.12 (Mon Dec 4 22:04:37 UTC 2006)
on Windows when a not recognized renderer type is asked.

  • Participants
  • Parent commits 74f8b7d
  • Branches default

Comments (0)

Files changed (2)

File sphinx/ext/

 from docutils.parsers.rst import directives
 from sphinx.errors import SphinxError
-from sphinx.util.osutil import ensuredir, ENOENT, EPIPE
+from sphinx.util.osutil import ensuredir, ENOENT, EPIPE, EINVAL
 from sphinx.util.compat import Directive
         self.builder._graphviz_warned_dot = True
         return None, None
+    wentWrong = False
         # Graphviz may close standard input when an error occurs,
         # resulting in a broken pipe on communicate()
     except OSError, err:
         if err.errno != EPIPE:
+        wentWrong = True
+    except IOError, err:
+        if err.errno != EINVAL:
+            raise
+        wentWrong = True
+    if wentWrong:
         # in this case, read the standard output and standard error streams
         # directly, to get the error message(s)
         stdout, stderr =,

File sphinx/util/

 EEXIST = getattr(errno, 'EEXIST', 0)
 ENOENT = getattr(errno, 'ENOENT', 0)
 EPIPE  = getattr(errno, 'EPIPE', 0)
+EINVAL = getattr(errno, 'EINVAL', 0)
 # SEP separates path elements in the canonical file names