diff options
| author | Benoit Allard <benoit@aeteurope.nl> | 2011-07-14 16:57:01 +0200 |
|---|---|---|
| committer | Benoit Allard <benoit@aeteurope.nl> | 2011-07-14 16:57:01 +0200 |
| commit | 80afe4fb9ff0bf9a50a896ca0b262dfee0d04635 (patch) | |
| tree | 5d8fcda0c50f4e6f174c4627eaf3a8bf5a56e610 /sphinx | |
| parent | fe9087e64682c2065f9fdb263f6a6dede725649c (diff) | |
| download | sphinx-80afe4fb9ff0bf9a50a896ca0b262dfee0d04635.tar.gz | |
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.
Diffstat (limited to 'sphinx')
| -rw-r--r-- | sphinx/ext/graphviz.py | 9 | ||||
| -rw-r--r-- | sphinx/util/osutil.py | 1 |
2 files changed, 9 insertions, 1 deletions
diff --git a/sphinx/ext/graphviz.py b/sphinx/ext/graphviz.py index e645ad87..b54cb3c0 100644 --- a/sphinx/ext/graphviz.py +++ b/sphinx/ext/graphviz.py @@ -25,7 +25,7 @@ from docutils import nodes 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 @@ -163,6 +163,7 @@ def render_dot(self, code, options, format, prefix='graphviz'): self.builder.config.graphviz_dot) self.builder._graphviz_warned_dot = True return None, None + wentWrong = False try: # Graphviz may close standard input when an error occurs, # resulting in a broken pipe on communicate() @@ -170,6 +171,12 @@ def render_dot(self, code, options, format, prefix='graphviz'): except OSError, err: if err.errno != EPIPE: raise + 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 = p.stdout.read(), p.stderr.read() diff --git a/sphinx/util/osutil.py b/sphinx/util/osutil.py index 487a5afc..b7a12cda 100644 --- a/sphinx/util/osutil.py +++ b/sphinx/util/osutil.py @@ -21,6 +21,7 @@ from os import path 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 # |
