From dd34a771ad792b29060735908f75176a6cd2a514 Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Wed, 27 Jun 2018 13:19:59 -0400 Subject: [PATCH] .sym: quote units with spaces --- canmatrix/sym.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/canmatrix/sym.py b/canmatrix/sym.py index 6a480271..1f2c7dc6 100644 --- a/canmatrix/sym.py +++ b/canmatrix/sym.py @@ -71,7 +71,12 @@ def createSignal(db, signal): if signal.attributes.get('HexadecimalOutput', False): output += "-h " if len(signal.unit) > 0: - output += "/u:%s " % (signal.unit[0:16]) + t = signal.unit[0:16] + if " " in t: + format_string = '/u:"%s" ' + else: + format_string = '/u:%s ' + output += format_string % (t) if float(signal.factor) != 1: output += "/f:%s " % (format_float(signal.factor)) if float(signal.offset) != 0: