Fix SVGHMI exception when running on Windows, missing ENODATA in errno. wxPython4
authorEdouard Tisserant <edouard.tisserant@gmail.com>
Thu, 09 Sep 2021 21:52:27 +0200
branchwxPython4
changeset 3310 6a6d3c318a6b
parent 3309 446b2c3da6e6
child 3311 d73af2eeea05
Fix SVGHMI exception when running on Windows, missing ENODATA in errno.
svghmi/svghmi_server.py
--- a/svghmi/svghmi_server.py	Thu Sep 09 09:37:03 2021 +0200
+++ b/svghmi/svghmi_server.py	Thu Sep 09 21:52:27 2021 +0200
@@ -241,6 +241,9 @@
 svghmi_servers = {}
 svghmi_send_thread = None
 
+# python's errno on windows seems to have no ENODATA
+ENODATA = errno.ENODATA if hasattr(errno,"ENODATA") else None
+
 def SendThreadProc():
     global svghmi_session_manager
     size = ctypes.c_uint32()
@@ -255,7 +258,7 @@
             if res == 0:
                 svghmi_session.sendMessage(
                     ctypes.string_at(ptr.value,size.value))
-            elif res == errno.ENODATA:
+            elif res == ENODATA:
                 # this happens when there is no data after wakeup
                 # because of hmi data refresh period longer than
                 # PLC common ticktime