--- a/etherlab/EthercatMaster.py Tue Sep 24 15:18:25 2013 +0200
+++ b/etherlab/EthercatMaster.py Fri Sep 27 17:49:40 2013 +0200
@@ -219,26 +219,44 @@
config_filepath = self.ConfigFileName()
if os.path.isfile(config_filepath):
config_xmlfile = open(config_filepath, 'r')
- self.Config = etree.fromstring(
- config_xmlfile.read(), EtherCATConfigParser)
+ EtherCATConfigParser.LoadXMLString(config_xmlfile.read())
+ self.GetCTRoot().logger.write_error( + _("Couldn't load %s network configuration file.") % CTNName) + if self.Config is None: self.Config = EtherCATConfigParser.CreateElement("EtherCATConfig")
process_filepath = self.ProcessVariablesFileName()
+ self.ProcessVariables = None if os.path.isfile(process_filepath):
process_xmlfile = open(process_filepath, 'r')
- self.ProcessVariables = etree.fromstring(
- process_xmlfile.read(), ProcessVariablesParser)
- process_is_saved = True
+ self.ProcessVariables, error = \ + ProcessVariablesParser.LoadXMLString(process_xmlfile.read()) + process_is_saved = True
+ self.GetCTRoot().logger.write_error( + _("Couldn't load %s network process variables file.") % CTNName) + if self.ProcessVariables is None: self.ProcessVariables = ProcessVariablesParser.CreateElement("ProcessVariables")
if config_is_saved and process_is_saved:
@@ -541,7 +559,6 @@
type_infos = slave.getType()
device, module_extra_params = self.GetModuleInfos(type_infos)
- print "Get Entries List", limits
entries = device.GetEntriesList(limits)
entries_list = entries.items()
--- a/etherlab/etherlab.py Tue Sep 24 15:18:25 2013 +0200
+++ b/etherlab/etherlab.py Fri Sep 27 17:49:40 2013 +0200
@@ -6,7 +6,7 @@
-from ConfigTreeNode import ConfigTreeNode
+from ConfigTreeNode import ConfigTreeNode, XSDSchemaErrorMessage from PLCControler import UndoBuffer, LOCATION_CONFNODE, LOCATION_MODULE, LOCATION_GROUP, LOCATION_VAR_INPUT, LOCATION_VAR_OUTPUT, LOCATION_VAR_MEMORY
from EthercatSlave import ExtractHexDecValue, ExtractName
@@ -203,10 +203,12 @@
xmlfile = open(filepath, 'r')
- self.modules_infos = etree.fromstring(
- xmlfile.read(), EtherCATInfoParser)
+ self.modules_infos, error = EtherCATInfoParser.LoadXMLString(xmlfile.read()) + self.GetCTRoot().logger.write_warning( + XSDSchemaErrorMessage % (filepath + error)) + self.modules_infos, error = None, unicode(exc) if self.modules_infos is not None:
@@ -233,8 +235,13 @@
raise ValueError, "Not such group \"%\"" % device_group
vendor_category["groups"][device_group]["devices"].append(
(device.getType().getcontent(), device))
+ self.GetCTRoot().logger.write_error( + _("Couldn't load %s XML file:\n%s") % (filepath, error)) def GetModulesLibrary(self, profile_filter=None):