i tried to write a Python-Client, which connects to an Codesys OPC UA-Server. I created the server with the Symbol Configuration on Codesys where i released 3 variables. This server is not certificated or secured.
Then i tried to connect to the server with this Python-code:
import sys
from opcua import Client
url = "opc.tcp://10.42.0.1:4840"
try:
client = Client(url)
client.connect()
print("Connected to Codesys-OPC-UA-Server")
except Exception as e:
print("err", e)
sys.exit(1)
Of course i installed the opcua library. When i start this code i get following error-message:
ServiceFault from server received in response to ActivateSessionRequest ServiceFault from server received in response to CloseSessionRequest err "The session cannor be used because ActivateSession has not been called."(BadSessionNotActivated)
Can anybody help me and say what went wrong? Thank you in advance!