From 9a81a93db8bc5a9702a6aeadb2f0b2ad7c115cad Mon Sep 17 00:00:00 2001 From: Thane Gill Date: Fri, 19 Mar 2021 13:53:14 -0700 Subject: [PATCH] Only add COMMENT if it exists. This allows setting it to `None` --- barcode/writer.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/barcode/writer.py b/barcode/writer.py index 139e525..1dc0f00 100755 --- a/barcode/writer.py +++ b/barcode/writer.py @@ -308,7 +308,8 @@ def _init(self, code): "height": SIZE.format(height), } _set_attributes(self._root, **attributes) - self._root.appendChild(self._document.createComment(COMMENT)) + if COMMENT: + self._root.appendChild(self._document.createComment(COMMENT)) # create group for easier handling in 3rd party software # like corel draw, inkscape, ... group = self._document.createElement("g")