joowani / binarytree

Python Library for Studying Binary Trees
http://binarytree.readthedocs.io
MIT License
1.81k stars 171 forks source link

Account for deprecation of DiGraph._repr_svg_ in graphviz (#40) #41

Closed scarf005 closed 2 years ago

scarf005 commented 2 years ago

image

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

joowani commented 2 years ago

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 commented 2 years ago

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

zhiweio commented 2 years ago

@joowani Can you release the PR to PyPI?