From 716172b2b42e80e1ecb5ef3444625cc1bcacdb78 Mon Sep 17 00:00:00 2001 From: Malte R Date: Tue, 17 Nov 2020 14:22:04 +0100 Subject: [PATCH] Small refactoring of graphviz_draw. The only observable effect should be that calling with output=None and (output_format="xlib" or fork=True) no longer causes an AttributeError. --- src/graph_tool/draw/graphviz_draw.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/graph_tool/draw/graphviz_draw.py b/src/graph_tool/draw/graphviz_draw.py index ed25c2c7..7df1889a 100644 --- a/src/graph_tool/draw/graphviz_draw.py +++ b/src/graph_tool/draw/graphviz_draw.py @@ -559,11 +559,11 @@ def graphviz_draw(g, pos=None, size=(15, 15), pin=False, layout=None, output.encode("utf8")) data = open(output).read() os.remove(output) - else: + elif output is not None: if output_format == "auto": if output == "": output_format = "xlib" - elif output is not None: + else: output_format = output.split(".")[-1] # if using xlib we need to fork the process, otherwise good ol' @@ -576,7 +576,7 @@ def graphviz_draw(g, pos=None, size=(15, 15), pin=False, layout=None, os._exit(0) # since we forked, it's good to be sure if output_format != "xlib": os.wait() - elif output is not None: + else: libgv.gvRenderFilename(gvc, gvg, output_format.encode("utf8"), output.encode("utf8")) -- GitLab