From 8bc3e8c9d09d213f8edecdae2c260dce8325d3ed Mon Sep 17 00:00:00 2001 From: Jakub Berka Date: Fri, 7 Jun 2019 15:08:32 +0200 Subject: [PATCH] Fix None value in node title When running this script I found an error: TypeError: Argument must be bytes or unicode, got 'None Type' In JSON file I had nodes with none in value. Converting nodeJSON['title'] to string solved this problem, on line 74. Regarding this issue on stackoverflow: https://stackoverflow.com/questions/44525081/lxml-html-set-error-typeerror-argument-must-be-bytes-or-unicode-got-nonetype I checked my lxml version, but I have the latest one. --- scripts/dialog_json2xml.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/dialog_json2xml.py b/scripts/dialog_json2xml.py index 9c2e30e..d26d99a 100644 --- a/scripts/dialog_json2xml.py +++ b/scripts/dialog_json2xml.py @@ -71,7 +71,7 @@ def convertNode(nodeJSON): #title if 'title' in nodeJSON: if nodeJSON['title'] != nodeJSON['dialog_node']: # WA adds title to all uploaded workspaces equal to dialog_name, this is cleanup TODO: remove the conditions when upgrading to new version of WA API - nodeXML.attrib['title'] = nodeJSON['title'] + nodeXML.attrib['title'] = str(nodeJSON['title']) #type if 'type' in nodeJSON: typeNodeXML = LET.Element('type')