python3 support: pylint, W1645 # (exception-message-attribute) Exception.message removed in Python 3
authorAndrey Skvortsov <andrej.skvortzov@gmail.com>
Thu, 11 Oct 2018 09:41:15 +0300
changeset 2447 1c04a50dc7ff
parent 2446 922f0d84f869
child 2448 1367b796e129
python3 support: pylint, W1645 # (exception-message-attribute) Exception.message removed in Python 3
PLCControler.py
PLCGenerator.py
etherlab/EthercatMaster.py
plcopen/plcopen.py
tests/tools/check_source.sh
--- a/PLCControler.py	Wed Oct 10 10:50:00 2018 +0300
+++ b/PLCControler.py	Thu Oct 11 09:41:15 2018 +0300
@@ -462,7 +462,7 @@
                     self.ProgramFilePath = filepath
                 return program_text, errors, warnings
             except PLCGenException as ex:
-                errors.append(ex.message)
+                errors.append(str(ex))
         else:
             errors.append("No project opened")
         return "", errors, warnings
--- a/PLCGenerator.py	Wed Oct 10 10:50:00 2018 +0300
+++ b/PLCGenerator.py	Thu Oct 11 09:41:15 2018 +0300
@@ -1027,7 +1027,7 @@
                     try:
                         self.GenerateBlock(instance, block_infos, body, None)
                     except ValueError as e:
-                        raise PLCGenException(e.message)
+                        raise PLCGenException(str(e))
                 elif isinstance(instance, ConnectorClass):
                     connector = instance.getname()
                     if self.ComputedConnectors.get(connector, None):
@@ -1305,7 +1305,7 @@
                 try:
                     paths.append(str(self.GenerateBlock(next, block_infos, body, connection, order, to_inout)))
                 except ValueError as e:
-                    raise PLCGenException(e.message)
+                    raise PLCGenException(str(e))
             elif isinstance(next, ContinuationClass):
                 name = next.getname()
                 computed_value = self.ComputedConnectors.get(name, None)
--- a/etherlab/EthercatMaster.py	Wed Oct 10 10:50:00 2018 +0300
+++ b/etherlab/EthercatMaster.py	Thu Oct 11 09:41:15 2018 +0300
@@ -250,7 +250,7 @@
                 if error is None:
                     config_is_saved = True
             except Exception as e:
-                error = e.message
+                error = str(e)
             config_xmlfile.close()
 
             if error is not None:
@@ -271,7 +271,7 @@
                 if error is None:
                     process_is_saved = True
             except Exception as e:
-                error = e.message
+                error = str(e)
             process_xmlfile.close()
 
             if error is not None:
--- a/plcopen/plcopen.py	Wed Oct 10 10:50:00 2018 +0300
+++ b/plcopen/plcopen.py	Thu Oct 11 09:41:15 2018 +0300
@@ -301,7 +301,7 @@
         return tree, error
 
     except Exception as e:
-        return None, e.message
+        return None, str(e)
 
 
 def LoadProject(filepath):
--- a/tests/tools/check_source.sh	Wed Oct 10 10:50:00 2018 +0300
+++ b/tests/tools/check_source.sh	Thu Oct 11 09:41:15 2018 +0300
@@ -366,6 +366,7 @@
     enable=$enable,W1629          # (nonzero-method) __nonzero__ method defined
     enable=$enable,W1602          # (basestring-builtin) basestring built-in referenced
     enable=$enable,W1646          # (invalid-str-codec) non-text encoding used in str.decode
+    enable=$enable,W1645          # (exception-message-attribute) Exception.message removed in Python 3
     # enable=
 
     options=