changeset 2719 | 745b64e7c695 |
parent 2706 | 65f35ac97cd6 |
child 2739 | 7278186a2083 |
--- a/plcopen/plcopen.py Fri Dec 25 17:12:02 2020 +0000 +++ b/plcopen/plcopen.py Mon Jan 18 10:59:28 2021 +0100 @@ -331,12 +331,16 @@ def SaveProject(project, filepath): - project_file = open(filepath, 'w') - project_file.write(etree.tostring( + content = etree.tostring( project, pretty_print=True, xml_declaration=True, - encoding='utf-8')) + encoding='utf-8') + + assert len(content) != 0 + + project_file = open(filepath, 'w') + project_file.write(content) project_file.close()