Skip to content

Conversation

@scarf005
Copy link
Contributor

@scarf005 scarf005 commented Apr 25, 2022

image

replaces Diagraph's _repr_svg() method (deprecated) into _repr_image_svg_xml()

replaces Diagraph's _repr_svg() method (deprecated) into _repr_image_svg_xml()

fixes #40
@joowani
Copy link
Owner

joowani commented Apr 26, 2022

Hi @scarf005,

Thank you for reporting this. Could you please do something like below instead to maintain backward compatibility?

try:
    try:
        # noinspection PyProtectedMember
        return str(self.graphviz()._repr_svg_())
    except AttributeError:
        # noinspection PyProtectedMember
    	return self.graphviz()._repr_image_svg_xml()

except (SubprocessError, ExecutableNotFound, FileNotFoundError):
    return self.svg()

@scarf005
Copy link
Contributor Author

thank you for letting me check for backward compatibility. fixed to code above.

@joowani joowani changed the base branch from main to dev April 26, 2022 22:06
@joowani joowani changed the title fix: Fix error on jupyter notebook (#40) Account for deprecation of DiGraph._repr_svg_ in graphviz (#40) Jun 28, 2022
@joowani joowani merged commit 48caad6 into joowani:dev Jun 28, 2022
@scarf005 scarf005 deleted the patch-1 branch June 28, 2022 01:59
@zhiweio
Copy link

zhiweio commented Jul 18, 2022

@joowani Can you release the PR to PyPI?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

graphviz's _repr_svg_() deprecation causes error on jupyter notebook

3 participants