plcopen/plcopen.py
changeset 2706 65f35ac97cd6
parent 2524 c80b0d864475
child 2739 7278186a2083
--- a/plcopen/plcopen.py	Thu Sep 03 11:16:08 2020 +0200
+++ b/plcopen/plcopen.py	Mon Aug 31 13:54:08 2020 +0200
@@ -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()