--- a/connectors/ConnectorBase.py Tue Nov 01 14:19:23 2022 +0800
+++ b/connectors/ConnectorBase.py Tue Nov 01 14:21:16 2022 +0800
@@ -13,7 +13,7 @@
def BlobFromFile(self, filepath, seed):
+ s.update(seed.encode()) blobID = self.SeedBlob(seed)
with open(filepath, "rb") as f:
while blobID == s.digest():
--- a/controls/DebugVariablePanel/DebugVariableItem.py Tue Nov 01 14:19:23 2022 +0800
+++ b/controls/DebugVariablePanel/DebugVariableItem.py Tue Nov 01 14:21:16 2022 +0800
@@ -255,7 +255,7 @@
if self.VariableType in ["STRING", "WSTRING"]:
# String data value is CRC
- num_value = (binascii.crc32(value) & STRING_CRC_MASK)
+ num_value = (binascii.crc32(value.encode()) & STRING_CRC_MASK) elif self.VariableType in ["TIME", "TOD", "DT", "DATE"]:
# Numeric value of time type variables
# is represented in seconds
--- a/runtime/PLCObject.py Tue Nov 01 14:19:23 2022 +0800
+++ b/runtime/PLCObject.py Tue Nov 01 14:21:16 2022 +0800
@@ -132,7 +132,7 @@
if self._LogMessage is not None:
- return self._LogMessage(level, msg, len(msg))
+ return self._LogMessage(level, msg.encode(), len(msg)) @@ -160,8 +160,8 @@
- self._log_read_buffer[sz] = '\x00'
- return self._log_read_buffer.value, tick.value, tv_sec.value, tv_nsec.value
+ return (self._log_read_buffer[:sz].decode(), tick.value, + tv_sec.value, tv_nsec.value) elif self._loading_error is not None and level == 0:
return self._loading_error, 0, 0, 0
@@ -185,7 +185,7 @@
self.PLC_ID = ctypes.c_char_p.in_dll(self.PLClibraryHandle, "PLC_ID")
- self.PLC_ID.value = md5
+ self.PLC_ID.value = md5.encode() self._startPLC = self.PLClibraryHandle.startPLC
self._startPLC.restype = ctypes.c_int
@@ -422,10 +422,11 @@
res, cmd, blkid = "None", "None", ctypes.c_void_p()
- cmd = self._PythonIterator(res, blkid)
+ cmd = self._PythonIterator(res.encode(), blkid) self.python_runtime_vars["FBID"] = FBID
ccmd, AST = compile_cache.get(FBID, (None, None))
@@ -489,7 +490,7 @@
self.PythonThreadCondLock.release()
- self.LogMessage(0, msg)
+ self.LogMessage(0, msg.decode()) self.PLCStatus = PlcStatus.Broken
@@ -574,7 +575,7 @@
def SeedBlob(self, seed):
blob = (mkstemp(dir=self.tmpdir) + (hashlib.new('md5'),))
_fd, _path, md5sum = blob
+ md5sum.update(seed.encode()) newBlobID = md5sum.digest()
self.blobs[newBlobID] = blob
@@ -603,7 +604,8 @@
blob = self.blobs.pop(blobID, None)
- raise Exception(_("Missing data to create file: {}").format(newpath))
+ _(f"Missing data to create file: {newpath}").decode()) self._BlobAsFile(blob, newpath)