diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2018-12-15 20:38:46 +0900 |
---|---|---|
committer | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2018-12-19 19:26:50 +0900 |
commit | d0f5862597c1b4fd5210433a323be6b21d99d1ee (patch) | |
tree | 44c13629c970e84c24bb9413d728a8ed75a487c1 /sphinx/ext/graphviz.py | |
parent | 3905cb8b7cb92815a6ee41a7d25ad2eaa5b8a443 (diff) | |
download | sphinx-git-d0f5862597c1b4fd5210433a323be6b21d99d1ee.tar.gz |
Replace EnvironmentError and IOError by OSError
Since python 3.3, EnvironmentError and IOError were merged into
OSError.
Diffstat (limited to 'sphinx/ext/graphviz.py')
-rw-r--r-- | sphinx/ext/graphviz.py | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/sphinx/ext/graphviz.py b/sphinx/ext/graphviz.py index eee76d46b..dcd035713 100644 --- a/sphinx/ext/graphviz.py +++ b/sphinx/ext/graphviz.py @@ -26,7 +26,7 @@ from sphinx.util.docutils import SphinxDirective from sphinx.util.fileutil import copy_asset from sphinx.util.i18n import search_image_for_language from sphinx.util.nodes import set_source_info -from sphinx.util.osutil import ensuredir, EPIPE, EINVAL +from sphinx.util.osutil import ensuredir if False: # For type annotation @@ -144,7 +144,7 @@ class Graphviz(SphinxDirective): try: with open(filename, encoding='utf-8') as fp: dotcode = fp.read() - except (IOError, OSError): + except OSError: return [document.reporter.warning( __('External Graphviz file %r not found or reading ' 'it failed') % filename, line=self.lineno)] @@ -256,9 +256,7 @@ def render_dot(self, code, options, format, prefix='graphviz'): # Graphviz may close standard input when an error occurs, # resulting in a broken pipe on communicate() stdout, stderr = p.communicate(code.encode()) - except (OSError, IOError) as err: - if err.errno not in (EPIPE, EINVAL): - raise + except BrokenPipeError: # 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() |