modbus/modbus.py
changeset 2648 e4ab768170f9
parent 2647 990004083eb8
child 2654 7575050a80c5
equal deleted inserted replaced
2647:990004083eb8 2648:e4ab768170f9
   619         #   for e.g., convert the tuple (0, 3, 4) to "0.3.4"
   619         #   for e.g., convert the tuple (0, 3, 4) to "0.3.4"
   620 
   620 
   621         for i in range(0, len(IPServer_port_numbers) - 1):
   621         for i in range(0, len(IPServer_port_numbers) - 1):
   622             for j in range(i + 1, len(IPServer_port_numbers)):
   622             for j in range(i + 1, len(IPServer_port_numbers)):
   623                 if IPServer_port_numbers[i][1] == IPServer_port_numbers[j][1]:
   623                 if IPServer_port_numbers[i][1] == IPServer_port_numbers[j][1]:
   624                     self.GetCTRoot().logger.write_warning(
   624                     error_message = _("Error: Modbus/IP Servers %{a1}.x and %{a2}.x use the same port number {a3}.\n").format(
   625                         _("Error: Modbus/IP Servers %{a1}.x and %{a2}.x use the same port number {a3}.\n").
   625                                         a1=_lt_to_str(IPServer_port_numbers[i][0]),
   626                         format(
   626                                         a2=_lt_to_str(IPServer_port_numbers[j][0]),
   627                             a1=_lt_to_str(IPServer_port_numbers[i][0]),
   627                                         a3=IPServer_port_numbers[j][1])
   628                             a2=_lt_to_str(IPServer_port_numbers[j][0]),
   628                     self.FatalError(error_message)
   629                             a3=IPServer_port_numbers[j][1]))
   629                     #self.GetCTRoot().logger.write_warning(error_message)
   630                     raise Exception
   630                     #raise Exception
   631                     # TODO: return an error code instead of raising an
       
   632                     # exception
       
   633 
   631 
   634         # Determine the current location in Beremiz's project configuration
   632         # Determine the current location in Beremiz's project configuration
   635         # tree
   633         # tree
   636         current_location = self.GetCurrentLocation()
   634         current_location = self.GetCurrentLocation()
   637 
   635