diff -r 76e8ec46828a -r 745b64e7c695 plcopen/plcopen.py --- 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()