From e337c031d18716c8168be33841ca9953e7e71600 Mon Sep 17 00:00:00 2001 From: minix1234 Date: Mon, 30 Sep 2019 08:03:33 -0400 Subject: [PATCH 1/2] fixed issue with map(none, #, #) in iproperties() --- src/OpenOPC.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/OpenOPC.py b/src/OpenOPC.py index 9ed5d89..d2b6059 100644 --- a/src/OpenOPC.py +++ b/src/OpenOPC.py @@ -933,7 +933,7 @@ def iproperties(self, tags, id=None): count, property_id, descriptions, datatypes = self._opc.QueryAvailableProperties(tag) # Remove bogus negative property id (not sure why this sometimes happens) - tag_properties = map(None, property_id, descriptions) + tag_properties = list(map(lambda x, y: (x, y), property_id, descriptions)) property_id = [p for p, d in tag_properties if p > 0] descriptions = [d for p, d in tag_properties if p > 0] @@ -973,9 +973,9 @@ def iproperties(self, tags, id=None): else: tag_properties = [values] else: - tag_properties = map(None, property_id, values) + tag_properties = list(map(lambda x, y: (x, y), property_id, values)) else: - tag_properties = map(None, property_id, descriptions, values) + tag_properties = list(map(lambda x, y, z: (x, y, z), property_id, descriptions, values)) tag_properties.insert(0, (0, 'Item ID (virtual property)', tag)) if include_name: tag_properties.insert(0, (0, tag)) From 20165425d69ff0877bb896d9d4f1f8a30daa3f8e Mon Sep 17 00:00:00 2001 From: minix1234 <48591487+minix1234@users.noreply.github.com> Date: Mon, 30 Sep 2019 13:09:59 -0400 Subject: [PATCH 2/2] fails to start, access level with is.environ, used getvar --- src/OpenOPCService.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/OpenOPCService.py b/src/OpenOPCService.py index 0aeb0de..069bcda 100644 --- a/src/OpenOPCService.py +++ b/src/OpenOPCService.py @@ -34,8 +34,8 @@ #Pyro4.config.SERIALIZER='marshal' opc_class = OpenOPC.OPC_CLASS -opc_gate_host = os.environ['OPC_GATE_HOST'] -opc_gate_port = int(os.environ['OPC_GATE_PORT']) +opc_gate_host = "localhost" +opc_gate_port = 7766 def getvar(env_var): """Read system environment variable from registry""" @@ -49,9 +49,9 @@ def getvar(env_var): # Get env vars directly from the Registry since a reboot is normally required # for the Local System account to inherit these. -#if getvar('OPC_CLASS'): opc_class = getvar('OPC_CLASS') -#if getvar('OPC_GATE_HOST'): opc_gate_host = getvar('OPC_GATE_HOST') -#if getvar('OPC_GATE_PORT'): opc_gate_port = int(getvar('OPC_GATE_PORT')) +if getvar('OPC_CLASS'): opc_class = getvar('OPC_CLASS') +if getvar('OPC_GATE_HOST'): opc_gate_host = getvar('OPC_GATE_HOST') +if getvar('OPC_GATE_PORT'): opc_gate_port = int(getvar('OPC_GATE_PORT')) @Pyro4.expose # needed for version 4.55 class opc(object): @@ -159,3 +159,4 @@ def SvcDoRun(self): daemon.shutdown() else: win32serviceutil.HandleCommandLine(OpcService) + \ No newline at end of file