diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index cdf7db2..c80f84e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -12,7 +12,7 @@ repos: - id: end-of-file-fixer - id: mixed-line-ending - repo: https://github.com/psf/black - rev: 22.1.0 + rev: 22.3.0 hooks: - id: black - repo: https://github.com/timothycrosley/isort diff --git a/binarytree/__init__.py b/binarytree/__init__.py index f8e0f1a..0aa957d 100644 --- a/binarytree/__init__.py +++ b/binarytree/__init__.py @@ -508,8 +508,12 @@ def _repr_svg_(self) -> str: # pragma: no cover .. _Jupyter notebooks: https://jupyter.org """ try: - # noinspection PyProtectedMember - return str(self.graphviz()._repr_svg_()) + try: + # noinspection PyProtectedMember + return str(self.graphviz()._repr_svg_()) + except AttributeError: + # noinspection PyProtectedMember + return str(self.graphviz()._repr_image_svg_xml()) except (SubprocessError, ExecutableNotFound, FileNotFoundError): return self.svg()