plcopen/plcopen.py
changeset 2706 65f35ac97cd6
parent 2524 c80b0d864475
child 2739 7278186a2083
equal deleted inserted replaced
2705:889ec6db6f7d 2706:65f35ac97cd6
   329         LOAD_POU_INSTANCES_PROJECT_TEMPLATE(body_type) % xml_string)
   329         LOAD_POU_INSTANCES_PROJECT_TEMPLATE(body_type) % xml_string)
   330     return project_pou_instances_xpath[body_type](root), error
   330     return project_pou_instances_xpath[body_type](root), error
   331 
   331 
   332 
   332 
   333 def SaveProject(project, filepath):
   333 def SaveProject(project, filepath):
   334     project_file = open(filepath, 'w')
   334     content = etree.tostring(
   335     project_file.write(etree.tostring(
       
   336         project,
   335         project,
   337         pretty_print=True,
   336         pretty_print=True,
   338         xml_declaration=True,
   337         xml_declaration=True,
   339         encoding='utf-8'))
   338         encoding='utf-8')
       
   339 
       
   340     assert len(content) != 0
       
   341         
       
   342     project_file = open(filepath, 'w')
       
   343     project_file.write(content)
   340     project_file.close()
   344     project_file.close()
   341 
   345 
   342 
   346 
   343 # ----------------------------------------------------------------------
   347 # ----------------------------------------------------------------------
   344 
   348