Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

%%dot magic doesn't work with recent versions of pydot #195

Open
jnahmias opened this issue Jul 28, 2019 · 0 comments
Open

%%dot magic doesn't work with recent versions of pydot #195

jnahmias opened this issue Jul 28, 2019 · 0 comments

Comments

@jnahmias
Copy link
Contributor

Any version of pydot >= 1.2.0, has a new interface which returns a list of graphs. Here's a patch that assumes a single graph is returned:

--- dot_magic.py.orig   2019-06-25 02:23:18.000000000 +0000
+++ dot_magic.py        2019-07-28 03:51:25.405139828 +0000
@@ -22,7 +22,7 @@
             import pydot
         except:
             raise Exception("You need to install pydot")
-        graph = pydot.graph_from_dot_data(str(code))
+        (graph,) = pydot.graph_from_dot_data(str(code))
         svg = graph.create_svg()
         if hasattr(svg, "decode"):
             svg = svg.decode("utf-8")
@@ -45,7 +45,7 @@
             import pydot
         except:
             raise Exception("You need to install pydot")
-        graph = pydot.graph_from_dot_data(str(self.code))
+        (graph,) = pydot.graph_from_dot_data(str(self.code))
         svg = graph.create_svg()
         if hasattr(svg, "decode"):
             svg = svg.decode("utf-8")
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

No branches or pull requests

1 participant