etherlab/CommonEtherCATFunction.py
changeset 2434 07f48018b6f5
parent 2423 2c7b7ae24d57
child 2437 105c20fdeb19
--- a/etherlab/CommonEtherCATFunction.py	Thu Oct 04 12:09:23 2018 +0300
+++ b/etherlab/CommonEtherCATFunction.py	Thu Oct 04 17:24:40 2018 +0300
@@ -9,8 +9,10 @@
 # See COPYING file for copyrights details.
 
 from __future__ import absolute_import
+from builtins import str as text
 import wx
 
+
 mailbox_protocols = ["AoE", "EoE", "CoE", "FoE", "SoE", "VoE"]
 
 
@@ -894,7 +896,7 @@
         vendor_spec_strings = []
         for element in device.getType().getcontent():
             data += element
-        if data != "" and isinstance(data, unicode):
+        if data != "" and isinstance(data, text):
             for vendor_spec_string in vendor_spec_strings:
                 if data == vendor_spec_string:
                     self.OrderIdx = vendor_spec_strings.index(data)+1
@@ -913,7 +915,7 @@
 
         #  element2-1; <EtherCATInfo>-<Descriptions>-<Devices>-<Device>-<GroupType>
         data = device.getGroupType()
-        if data is not None and isinstance(data, unicode):
+        if data is not None and isinstance(data, text):
             for vendor_spec_string in vendor_spec_strings:
                 if data == vendor_spec_string:
                     self.GroupIdx = vendor_spec_strings.index(data)+1
@@ -937,7 +939,7 @@
                         for device_item in group_etc["devices"]:
                             if device == device_item[1]:
                                 data = group_type
-                if data is not None and isinstance(data, unicode):
+                if data is not None and isinstance(data, text):
                     for vendor_spec_string in vendor_spec_strings:
                         if data == vendor_spec_string:
                             self.GroupIdx = vendor_spec_strings.index(data)+1
@@ -961,7 +963,7 @@
                     for device_item in group_etc["devices"]:
                         if device == device_item[1]:
                             data = group_etc["name"]
-        if data != "" and isinstance(data, unicode):
+        if data != "" and isinstance(data, text):
             for vendor_spec_string in vendor_spec_strings:
                 if data == vendor_spec_string:
                     groupnameflag = True
@@ -980,7 +982,7 @@
         for element in device.getName():
             if element.getLcId() == 1 or element.getLcId() == 1033:
                 data = element.getcontent()
-        if data != "" and isinstance(data, unicode):
+        if data != "" and isinstance(data, text):
             for vendor_spec_string in vendor_spec_strings:
                 if data == vendor_spec_string:
                     self.NameIdx = vendor_spec_strings.index(data)+1
@@ -1000,7 +1002,7 @@
         #  element5-1; <EtherCATInfo>-<Descriptions>-<Devices>-<Device>-<Image16x14>
         if device.getcontent() is not None:
             data = device.getcontent()
-            if data is not None and isinstance(data, unicode):
+            if data is not None and isinstance(data, text):
                 for vendor_spec_string in vendor_spec_strings:
                     if data == vendor_spec_string:
                         self.ImgIdx = vendor_spec_strings.index(data)+1
@@ -1024,7 +1026,7 @@
                         for device_item in group_etc["devices"]:
                             if device == device_item[1]:
                                 data = group_etc
-                if data is not None and isinstance(data, unicode):
+                if data is not None and isinstance(data, text):
                     for vendor_spec_string in vendor_spec_strings:
                         if data == vendor_spec_string:
                             self.ImgIdx = vendor_spec_strings.index(data)+1