q 1 rok pred
rodič
commit
115432ccf7
1 zmenil súbory, kde vykonal 3 pridanie a 3 odobranie
  1. 3 3
      jjq_support_1.py

+ 3 - 3
jjq_support_1.py

@@ -1,4 +1,4 @@
-import asyncio
+#!/usr/bin/env python3
 import redis
 
 from asyncua import Client
@@ -22,7 +22,7 @@ def get_opc_data():
     pool = redis.ConnectionPool(host=redis_ip, password='')
     redis_conn = redis.Redis(connection_pool=pool)
 
-    async with Client(url=opc_server_url) as client:
+    with Client(url=opc_server_url) as client:
         i = 0
         result_arr = {}
         print(datetime.now().strftime('Start_time:%Y-%m-%d %H:%M:%S.%f'))
@@ -30,7 +30,7 @@ def get_opc_data():
             try:
                 node = f"ns={ns};s={opc_point_arr[i]}"
                 tag = client.get_node(node)
-                value = await tag.read_value()
+                value = tag.read_value()
                 # redis值
                 redis_conn.set(str(opc_point_arr[i]), str(value))
                 arr_key = node.split("=")