From 13686776b902056e6898db0036535612e58755a6 Mon Sep 17 00:00:00 2001 From: Gustav Larsson Date: Wed, 30 Jul 2014 18:25:42 -0500 Subject: [PATCH] Fixes syntax error in older versions of graphviz. Older versions of graphviz (tested on version 2.26.3 (20100126.1600)) complains when an attribute is empty without quotes. [label=] fails but [label=""] works, so the quote_if_necessary function has been updated to accommodate this. --- pydot/__init__.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pydot/__init__.py b/pydot/__init__.py index 142b039..ed8d1de 100644 --- a/pydot/__init__.py +++ b/pydot/__init__.py @@ -257,6 +257,10 @@ def needs_quotes(s): def quote_if_necessary(s): + # Older versions of graphviz throws a syntax error for empty values without + # quotes, e.g. [label=] + if s == '': + return '""' if isinstance(s, bool): if s is True: