FreeOpcUa / python-opcua

LGPL Pure Python OPC-UA Client and Server
http://freeopcua.github.io/
GNU Lesser General Public License v3.0
1.37k stars 662 forks source link

OPC UA Discover #1477

Open eriktavares opened 2 years ago

eriktavares commented 2 years ago

OPC UA Discover runtime error

In Tools folder, i starded uadiscover, but an exception has occurred

Open python-opcua project in Pycharm, exe tools>uadiscover in pycharm with python 10.

!/usr/bin/env python

import sys import os sys.path.append(os.path.join(os.path.dirname(os.path.realpath(file)), ".."))

from opcua.tools import uadiscover

if name == "main": uadiscover()

Traceback (most recent call last): File "C:\Users\Erik\Documents\MachineLearning\FreeOpcUa\python-opcua\tools\uadiscover", line 11, in uadiscover() File "C:\Users\Erik\Documents\MachineLearning\FreeOpcUa\python-opcua\opcua\tools.py", line 599, in uadiscover for i, server in enumerate(client.connect_and_find_servers(), start=1): File "C:\Users\Erik\Documents\MachineLearning\FreeOpcUa\python-opcua\opcua\client\client.py", line 243, in connect_and_find_servers self.connect_socket() File "C:\Users\Erik\Documents\MachineLearning\FreeOpcUa\python-opcua\opcua\client\client.py", line 307, in connect_socket self.uaclient.connect_socket(self.server_url.hostname, self.server_url.port) File "C:\Users\Erik\Documents\MachineLearning\FreeOpcUa\python-opcua\opcua\client\ua_client.py", line 266, in connect_socket return self._uasocket.connect_socket(host, port) File "C:\Users\Erik\Documents\MachineLearning\FreeOpcUa\python-opcua\opcua\client\ua_client.py", line 155, in connect_socket sock = socket.create_connection((host, port), timeout=self.timeout) File "C:\Users\Erik\AppData\Local\Programs\Python\Python310\lib\socket.py", line 845, in create_connection raise err File "C:\Users\Erik\AppData\Local\Programs\Python\Python310\lib\socket.py", line 833, in create_connection sock.connect(sa) TimeoutError: timed out

Process finished with exit code 1

printPython

Version
Python-Version: 3.10

python-opcua Version (e.g. master branch, 0.9): 1.0

swamper123 commented 2 years ago

Hi,

first things first: This library is deprecated. You should switch to opcua-asyncio. Second thing: There was never a 1.0 version. Third: The TimeoutError is a legit error, if the socket connection never happened. Did your discovery server run on localhost?