You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a simple program that uses asyncua.sync.Client. The program simply connects to the server, disconnects, then re-connects. When attempting the second connect (or re-connect) I get an error.
The code:
import sys
from time import sleep
from asyncua.sync import Client
import logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__file__)
# end point
url = 'opc.tcp://10.0.1.56:55105'
class Handler():
def datachange_notification(self, node, val, data):
logger.info('value is:', val)
try:
client = Client(url)
logger.info('user connect')
client.connect()
sleep(1)
logger.info('user disconnect')
client.disconnect()
sleep(1)
logger.info('user connect')
client.connect()
except Exception as err:
logger.exception(err)
finally:
client.disconnect()
The output:
$ cd /home/david/python/opcua ; /usr/bin/env /home/david/python/opcua/.venv/bin/python3 /home/david/.vscode/extensions/ms-python.debugpy-2024.10.0-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher 55907 -- /home/david/python/opcua/main.py
INFO:/home/david/python/opcua/main.py:user connect
INFO:asyncua.client.client:connect
INFO:asyncua.client.ua_client.UaClient:opening connection
INFO:asyncua.uaprotocol:updating client limits to: TransportLimits(max_recv_buffer=65536, max_send_buffer=65536, max_chunk_count=640, max_message_size=41943040)
INFO:asyncua.client.ua_client.UASocketProtocol:open_secure_channel
INFO:asyncua.client.ua_client.UaClient:create_session
INFO:asyncua.client.client:find_endpoint [EndpointDescription(EndpointUrl='opc.tcp://SNetV16:55105', Server=ApplicationDescription(ApplicationUri='urn:Siemens.Automation.SimaticNET.S7OPT:(B1707412-DBE3-456B-98F1-40029ACA9F7E)', ProductUri='Siemens/SimaticNet/OpcUaServer/S7OPT', ApplicationName=LocalizedText(Locale='en', Text='OPC.SimaticNET.S7OPT'), ApplicationType_=<ApplicationType.Server: 0>, GatewayServerUri=None, DiscoveryProfileUri=None, DiscoveryUrls=['opc.tcp://SNetV16:55105']), ServerCertificate=b'0\x82\x04T0\x82\x03<\xa0\x03\x02\x01\x02\x02\t\x00\x80X\x0c\xd3\xfd\x19\xbf\x0b0\r\x06\t*\x86H\x86\xf7\r\x01\x01\x0b\x05\x00081\x1d0\x1b\x06\x03U\x04\x03\x0c\x14OPC.SimaticNET.S7OPT1\x170\x15\x06\n\t\x92&\x89\x93\xf2,d\x01\x19\x16\x07SNetV160\x1e\x17\r210116154629Z\x17\r410116154629Z081\x1d0\x1b\x06\x03U\x04\x03\x0c\x14OPC.SimaticNET.S7OPT1\x170\x15\x06\n\t\x92&\x89\x93\xf2,d\x01\x19\x16\x07SNetV160\x82\x01"0\r\x06\t*\x86H\x86\xf7\r\x01\x01\x01\x05\x00\x03\x82\x01\x0f\x000\x82\x01\n\x02\x82\x01\x01\x00\xbe\xb4^\xd9\xb5\xd8\xde|\x10\xe9\xc6\xec\x9e)*\xdd\x00io\xd8\x84>h\x1c\x12\xd9\x9d\xdf\x94\x89\x13\xb2C\x93\x1dW\xdcq/\x97@5\xd5$\x0f\xcf}\xfd\xd7#\xdfY\x0e\x04\\\x12\xba?==\xa9\xddJ\xa5jd3\x11L\xc8\xbfN\xc8"+Ti\x91\xbeA\xd4\xba\xbf\xcc[\xcf\x82\x8d$Y\x88)\xb7\xd8\xf8\xf7b\xa31\x16\xf4x\x92\xfcJ\xc2C\xf3\xd4\xc1;\xd1\xc8\xbd;vr)t\x868\x8a\xe3\xb34a\xb3)\x1d\xdf\tf\x8dx\x8c\xfa\xedm\xf3\xda\xae`\xfa\x80{\xcef6\xe2o+\xab\x11\xb1!\xeaB@\x03HD\xa9\x9ap\xc8\xec\xd9\xb1\xe6=\x84\x8a\x10\x868p\x18\x956\xed\xf54\xde\xfd\x18\x9b\xb9\xd7\xac\xba\xcb\xf3i\xf1fuC\xc90\x9f\xad\x7fq\xe7VI\xb2zv\x18Z\xd4\xc1<3f\x8c\x92\xde\xe3\xd0\x9e\xd8\x1c\x8f\x95\xb0\xea\xcaT\x83F\xf6\x9ej\xc7"\xe8I\x06P\x02Z?\x18\xa3N\xc7\xc6,\xb9\xac5r\'K\x02\x03\x01\x00\x01\xa3\x82\x01_0\x82\x01[0\x0c\x06\x03U\x1d\x13\x01\x01\xff\x04\x020\x000\x0e\x06\x03U\x1d\x0f\x01\x01\xff\x04\x04\x03\x02\x02\xf40 \x06\x03U\x1d%\x01\x01\xff\x04\x160\x14\x06\x08+\x06\x01\x05\x05\x07\x03\x01\x06\x08+\x06\x01\x05\x05\x07\x03\x020,\x06\t`\x86H\x01\x86\xf8B\x01\r\x04\x1f\x16\x1dOpenSSL Generated Certificate0\x1d\x06\x03U\x1d\x0e\x04\x16\x04\x14\xe7X\xf6\xc2\xb1\xb1\n\xb8\x1a\xc4H\xff61\xe5\x83\xde\x16Vr0h\x06\x03U\x1d#\x04a0_\x80\x14\xe7X\xf6\xc2\xb1\xb1\n\xb8\x1a\xc4H\xff61\xe5\x83\xde\x16Vr\xa1<\xa4:081\x1d0\x1b\x06\x03U\x04\x03\x0c\x14OPC.SimaticNET.S7OPT1\x170\x15\x06\n\t\x92&\x89\x93\xf2,d\x01\x19\x16\x07SNetV16\x82\t\x00\x80X\x0c\xd3\xfd\x19\xbf\x0b0b\x06\x03U\x1d\x11\x04[0Y\x86Nurn:Siemens.Automation.SimaticNET.S7OPT:(B1707412-DBE3-456B-98F1-40029ACA9F7E)\x82\x07SNetV160\r\x06\t*\x86H\x86\xf7\r\x01\x01\x0b\x05\x00\x03\x82\x01\x01\x00Q\xd3_\xedP0\xd2u\t\x04\xde\xe0\xef\x00(\xd21Tz2\xb8\xa4F&\xdeWl\x9a7Q=`n\xa5&\xb8Dv\x95y\x87H\xb1\xfa\xbf\x95\xc3\x11\xb4\x06\'\xb0\xf5\x05P\xcd\xd5;x\x97:\xaf\xe8\x8f\x1d\xf2\xc1\xe3\xbb\xef\r\xac4\xadLW(\x1awm\x94\x1f]\xec]\x86\xf8\xf2\xa7b\xbd\x91\x84%\xbf\x94y@\xb5\xe9\x89\xb6\x8c\xed\xc4\xb6a\xa9\\\xf7\xc3\xf3\xa9\xd7\xfc\xec\xc8\xb1\xfc\x93\xd6\xeaRQ\xbbr\xea\xef\xe2\xc7U\xe4z]\x88\xea\xfe\x99yI\xa3\xcf\xc3\xc4\xaf\xd7\xb3%\x0c|\xb2\xea\nB\xb5\xcb\xd9\xbfE\'\xa3\x14\x96\x8e\x1c\xd84$^\x93)7>\xa2E!y\x1a\x08\xff\r\xe5\x1f\xd2\x13\xa6\x05z\xe89\x9aF\x08A#\x8b\x0ep\xedr\xa3]\x841\xb7\xbd\xdb\x93g\xc4\x0e$\xe5\x00\x11\x94j\xbc\xf9\x8c>1\x18ek\x16E\x89\x17\xe3 \xf4h\x1d\x98R\xc1I\xfa\xa1\xdaG\xef^W\xe2\xa46{s\xef\xa8\xa7\x97\x1a\r', SecurityMode=<MessageSecurityMode.None_: 1>, SecurityPolicyUri='http://opcfoundation.org/UA/SecurityPolicy#None', UserIdentityTokens=[UserTokenPolicy(PolicyId='Anonymous', TokenType=<UserTokenType.Anonymous: 0>, IssuedTokenType=None, IssuerEndpointUrl=None, SecurityPolicyUri=None), UserTokenPolicy(PolicyId='UserName', TokenType=<UserTokenType.UserName: 1>, IssuedTokenType=None, IssuerEndpointUrl=None, SecurityPolicyUri='http://opcfoundation.org/UA/SecurityPolicy#Basic256')], TransportProfileUri='http://opcfoundation.org/UA-Profile/Transport/uatcp-uasc-uabinary', SecurityLevel=0), EndpointDescription(EndpointUrl='opc.tcp://SNetV16:55105', Server=ApplicationDescription(ApplicationUri='urn:Siemens.Automation.SimaticNET.S7OPT:(B1707412-DBE3-456B-98F1-40029ACA9F7E)', ProductUri='Siemens/SimaticNet/OpcUaServer/S7OPT', ApplicationName=LocalizedText(Locale='en', Text='OPC.SimaticNET.S7OPT'), ApplicationType_=<ApplicationType.Server: 0>, GatewayServerUri=None, DiscoveryProfileUri=None, DiscoveryUrls=['opc.tcp://SNetV16:55105']), ServerCertificate=b'0\x82\x04T0\x82\x03<\xa0\x03\x02\x01\x02\x02\t\x00\x80X\x0c\xd3\xfd\x19\xbf\x0b0\r\x06\t*\x86H\x86\xf7\r\x01\x01\x0b\x05\x00081\x1d0\x1b\x06\x03U\x04\x03\x0c\x14OPC.SimaticNET.S7OPT1\x170\x15\x06\n\t\x92&\x89\x93\xf2,d\x01\x19\x16\x07SNetV160\x1e\x17\r210116154629Z\x17\r410116154629Z081\x1d0\x1b\x06\x03U\x04\x03\x0c\x14OPC.SimaticNET.S7OPT1\x170\x15\x06\n\t\x92&\x89\x93\xf2,d\x01\x19\x16\x07SNetV160\x82\x01"0\r\x06\t*\x86H\x86\xf7\r\x01\x01\x01\x05\x00\x03\x82\x01\x0f\x000\x82\x01\n\x02\x82\x01\x01\x00\xbe\xb4^\xd9\xb5\xd8\xde|\x10\xe9\xc6\xec\x9e)*\xdd\x00io\xd8\x84>h\x1c\x12\xd9\x9d\xdf\x94\x89\x13\xb2C\x93\x1dW\xdcq/\x97@5\xd5$\x0f\xcf}\xfd\xd7#\xdfY\x0e\x04\\\x12\xba?==\xa9\xddJ\xa5jd3\x11L\xc8\xbfN\xc8"+Ti\x91\xbeA\xd4\xba\xbf\xcc[\xcf\x82\x8d$Y\x88)\xb7\xd8\xf8\xf7b\xa31\x16\xf4x\x92\xfcJ\xc2C\xf3\xd4\xc1;\xd1\xc8\xbd;vr)t\x868\x8a\xe3\xb34a\xb3)\x1d\xdf\tf\x8dx\x8c\xfa\xedm\xf3\xda\xae`\xfa\x80{\xcef6\xe2o+\xab\x11\xb1!\xeaB@\x03HD\xa9\x9ap\xc8\xec\xd9\xb1\xe6=\x84\x8a\x10\x868p\x18\x956\xed\xf54\xde\xfd\x18\x9b\xb9\xd7\xac\xba\xcb\xf3i\xf1fuC\xc90\x9f\xad\x7fq\xe7VI\xb2zv\x18Z\xd4\xc1<3f\x8c\x92\xde\xe3\xd0\x9e\xd8\x1c\x8f\x95\xb0\xea\xcaT\x83F\xf6\x9ej\xc7"\xe8I\x06P\x02Z?\x18\xa3N\xc7\xc6,\xb9\xac5r\'K\x02\x03\x01\x00\x01\xa3\x82\x01_0\x82\x01[0\x0c\x06\x03U\x1d\x13\x01\x01\xff\x04\x020\x000\x0e\x06\x03U\x1d\x0f\x01\x01\xff\x04\x04\x03\x02\x02\xf40 \x06\x03U\x1d%\x01\x01\xff\x04\x160\x14\x06\x08+\x06\x01\x05\x05\x07\x03\x01\x06\x08+\x06\x01\x05\x05\x07\x03\x020,\x06\t`\x86H\x01\x86\xf8B\x01\r\x04\x1f\x16\x1dOpenSSL Generated Certificate0\x1d\x06\x03U\x1d\x0e\x04\x16\x04\x14\xe7X\xf6\xc2\xb1\xb1\n\xb8\x1a\xc4H\xff61\xe5\x83\xde\x16Vr0h\x06\x03U\x1d#\x04a0_\x80\x14\xe7X\xf6\xc2\xb1\xb1\n\xb8\x1a\xc4H\xff61\xe5\x83\xde\x16Vr\xa1<\xa4:081\x1d0\x1b\x06\x03U\x04\x03\x0c\x14OPC.SimaticNET.S7OPT1\x170\x15\x06\n\t\x92&\x89\x93\xf2,d\x01\x19\x16\x07SNetV16\x82\t\x00\x80X\x0c\xd3\xfd\x19\xbf\x0b0b\x06\x03U\x1d\x11\x04[0Y\x86Nurn:Siemens.Automation.SimaticNET.S7OPT:(B1707412-DBE3-456B-98F1-40029ACA9F7E)\x82\x07SNetV160\r\x06\t*\x86H\x86\xf7\r\x01\x01\x0b\x05\x00\x03\x82\x01\x01\x00Q\xd3_\xedP0\xd2u\t\x04\xde\xe0\xef\x00(\xd21Tz2\xb8\xa4F&\xdeWl\x9a7Q=`n\xa5&\xb8Dv\x95y\x87H\xb1\xfa\xbf\x95\xc3\x11\xb4\x06\'\xb0\xf5\x05P\xcd\xd5;x\x97:\xaf\xe8\x8f\x1d\xf2\xc1\xe3\xbb\xef\r\xac4\xadLW(\x1awm\x94\x1f]\xec]\x86\xf8\xf2\xa7b\xbd\x91\x84%\xbf\x94y@\xb5\xe9\x89\xb6\x8c\xed\xc4\xb6a\xa9\\\xf7\xc3\xf3\xa9\xd7\xfc\xec\xc8\xb1\xfc\x93\xd6\xeaRQ\xbbr\xea\xef\xe2\xc7U\xe4z]\x88\xea\xfe\x99yI\xa3\xcf\xc3\xc4\xaf\xd7\xb3%\x0c|\xb2\xea\nB\xb5\xcb\xd9\xbfE\'\xa3\x14\x96\x8e\x1c\xd84$^\x93)7>\xa2E!y\x1a\x08\xff\r\xe5\x1f\xd2\x13\xa6\x05z\xe89\x9aF\x08A#\x8b\x0ep\xedr\xa3]\x841\xb7\xbd\xdb\x93g\xc4\x0e$\xe5\x00\x11\x94j\xbc\xf9\x8c>1\x18ek\x16E\x89\x17\xe3 \xf4h\x1d\x98R\xc1I\xfa\xa1\xdaG\xef^W\xe2\xa46{s\xef\xa8\xa7\x97\x1a\r', SecurityMode=<MessageSecurityMode.SignAndEncrypt: 3>, SecurityPolicyUri='http://opcfoundation.org/UA/SecurityPolicy#Basic256Sha256', UserIdentityTokens=[UserTokenPolicy(PolicyId='Anonymous', TokenType=<UserTokenType.Anonymous: 0>, IssuedTokenType=None, IssuerEndpointUrl=None, SecurityPolicyUri=None), UserTokenPolicy(PolicyId='UserName', TokenType=<UserTokenType.UserName: 1>, IssuedTokenType=None, IssuerEndpointUrl=None, SecurityPolicyUri='http://opcfoundation.org/UA/SecurityPolicy#Basic256Sha256')], TransportProfileUri='http://opcfoundation.org/UA-Profile/Transport/uatcp-uasc-uabinary', SecurityLevel=115), EndpointDescription(EndpointUrl='opc.tcp://SNetV16:55105', Server=ApplicationDescription(ApplicationUri='urn:Siemens.Automation.SimaticNET.S7OPT:(B1707412-DBE3-456B-98F1-40029ACA9F7E)', ProductUri='Siemens/SimaticNet/OpcUaServer/S7OPT', ApplicationName=LocalizedText(Locale='en', Text='OPC.SimaticNET.S7OPT'), ApplicationType_=<ApplicationType.Server: 0>, GatewayServerUri=None, DiscoveryProfileUri=None, DiscoveryUrls=['opc.tcp://SNetV16:55105']), ServerCertificate=b'0\x82\x04T0\x82\x03<\xa0\x03\x02\x01\x02\x02\t\x00\x80X\x0c\xd3\xfd\x19\xbf\x0b0\r\x06\t*\x86H\x86\xf7\r\x01\x01\x0b\x05\x00081\x1d0\x1b\x06\x03U\x04\x03\x0c\x14OPC.SimaticNET.S7OPT1\x170\x15\x06\n\t\x92&\x89\x93\xf2,d\x01\x19\x16\x07SNetV160\x1e\x17\r210116154629Z\x17\r410116154629Z081\x1d0\x1b\x06\x03U\x04\x03\x0c\x14OPC.SimaticNET.S7OPT1\x170\x15\x06\n\t\x92&\x89\x93\xf2,d\x01\x19\x16\x07SNetV160\x82\x01"0\r\x06\t*\x86H\x86\xf7\r\x01\x01\x01\x05\x00\x03\x82\x01\x0f\x000\x82\x01\n\x02\x82\x01\x01\x00\xbe\xb4^\xd9\xb5\xd8\xde|\x10\xe9\xc6\xec\x9e)*\xdd\x00io\xd8\x84>h\x1c\x12\xd9\x9d\xdf\x94\x89\x13\xb2C\x93\x1dW\xdcq/\x97@5\xd5$\x0f\xcf}\xfd\xd7#\xdfY\x0e\x04\\\x12\xba?==\xa9\xddJ\xa5jd3\x11L\xc8\xbfN\xc8"+Ti\x91\xbeA\xd4\xba\xbf\xcc[\xcf\x82\x8d$Y\x88)\xb7\xd8\xf8\xf7b\xa31\x16\xf4x\x92\xfcJ\xc2C\xf3\xd4\xc1;\xd1\xc8\xbd;vr)t\x868\x8a\xe3\xb34a\xb3)\x1d\xdf\tf\x8dx\x8c\xfa\xedm\xf3\xda\xae`\xfa\x80{\xcef6\xe2o+\xab\x11\xb1!\xeaB@\x03HD\xa9\x9ap\xc8\xec\xd9\xb1\xe6=\x84\x8a\x10\x868p\x18\x956\xed\xf54\xde\xfd\x18\x9b\xb9\xd7\xac\xba\xcb\xf3i\xf1fuC\xc90\x9f\xad\x7fq\xe7VI\xb2zv\x18Z\xd4\xc1<3f\x8c\x92\xde\xe3\xd0\x9e\xd8\x1c\x8f\x95\xb0\xea\xcaT\x83F\xf6\x9ej\xc7"\xe8I\x06P\x02Z?\x18\xa3N\xc7\xc6,\xb9\xac5r\'K\x02\x03\x01\x00\x01\xa3\x82\x01_0\x82\x01[0\x0c\x06\x03U\x1d\x13\x01\x01\xff\x04\x020\x000\x0e\x06\x03U\x1d\x0f\x01\x01\xff\x04\x04\x03\x02\x02\xf40 \x06\x03U\x1d%\x01\x01\xff\x04\x160\x14\x06\x08+\x06\x01\x05\x05\x07\x03\x01\x06\x08+\x06\x01\x05\x05\x07\x03\x020,\x06\t`\x86H\x01\x86\xf8B\x01\r\x04\x1f\x16\x1dOpenSSL Generated Certificate0\x1d\x06\x03U\x1d\x0e\x04\x16\x04\x14\xe7X\xf6\xc2\xb1\xb1\n\xb8\x1a\xc4H\xff61\xe5\x83\xde\x16Vr0h\x06\x03U\x1d#\x04a0_\x80\x14\xe7X\xf6\xc2\xb1\xb1\n\xb8\x1a\xc4H\xff61\xe5\x83\xde\x16Vr\xa1<\xa4:081\x1d0\x1b\x06\x03U\x04\x03\x0c\x14OPC.SimaticNET.S7OPT1\x170\x15\x06\n\t\x92&\x89\x93\xf2,d\x01\x19\x16\x07SNetV16\x82\t\x00\x80X\x0c\xd3\xfd\x19\xbf\x0b0b\x06\x03U\x1d\x11\x04[0Y\x86Nurn:Siemens.Automation.SimaticNET.S7OPT:(B1707412-DBE3-456B-98F1-40029ACA9F7E)\x82\x07SNetV160\r\x06\t*\x86H\x86\xf7\r\x01\x01\x0b\x05\x00\x03\x82\x01\x01\x00Q\xd3_\xedP0\xd2u\t\x04\xde\xe0\xef\x00(\xd21Tz2\xb8\xa4F&\xdeWl\x9a7Q=`n\xa5&\xb8Dv\x95y\x87H\xb1\xfa\xbf\x95\xc3\x11\xb4\x06\'\xb0\xf5\x05P\xcd\xd5;x\x97:\xaf\xe8\x8f\x1d\xf2\xc1\xe3\xbb\xef\r\xac4\xadLW(\x1awm\x94\x1f]\xec]\x86\xf8\xf2\xa7b\xbd\x91\x84%\xbf\x94y@\xb5\xe9\x89\xb6\x8c\xed\xc4\xb6a\xa9\\\xf7\xc3\xf3\xa9\xd7\xfc\xec\xc8\xb1\xfc\x93\xd6\xeaRQ\xbbr\xea\xef\xe2\xc7U\xe4z]\x88\xea\xfe\x99yI\xa3\xcf\xc3\xc4\xaf\xd7\xb3%\x0c|\xb2\xea\nB\xb5\xcb\xd9\xbfE\'\xa3\x14\x96\x8e\x1c\xd84$^\x93)7>\xa2E!y\x1a\x08\xff\r\xe5\x1f\xd2\x13\xa6\x05z\xe89\x9aF\x08A#\x8b\x0ep\xedr\xa3]\x841\xb7\xbd\xdb\x93g\xc4\x0e$\xe5\x00\x11\x94j\xbc\xf9\x8c>1\x18ek\x16E\x89\x17\xe3 \xf4h\x1d\x98R\xc1I\xfa\xa1\xdaG\xef^W\xe2\xa46{s\xef\xa8\xa7\x97\x1a\r', SecurityMode=<MessageSecurityMode.SignAndEncrypt: 3>, SecurityPolicyUri='http://opcfoundation.org/UA/SecurityPolicy#Aes128_Sha256_RsaOaep', UserIdentityTokens=[UserTokenPolicy(PolicyId='Anonymous', TokenType=<UserTokenType.Anonymous: 0>, IssuedTokenType=None, IssuerEndpointUrl=None, SecurityPolicyUri=None), UserTokenPolicy(PolicyId='UserName', TokenType=<UserTokenType.UserName: 1>, IssuedTokenType=None, IssuerEndpointUrl=None, SecurityPolicyUri='http://opcfoundation.org/UA/SecurityPolicy#Aes128_Sha256_RsaOaep')], TransportProfileUri='http://opcfoundation.org/UA-Profile/Transport/uatcp-uasc-uabinary', SecurityLevel=120), EndpointDescription(EndpointUrl='opc.tcp://SNetV16:55105', Server=ApplicationDescription(ApplicationUri='urn:Siemens.Automation.SimaticNET.S7OPT:(B1707412-DBE3-456B-98F1-40029ACA9F7E)', ProductUri='Siemens/SimaticNet/OpcUaServer/S7OPT', ApplicationName=LocalizedText(Locale='en', Text='OPC.SimaticNET.S7OPT'), ApplicationType_=<ApplicationType.Server: 0>, GatewayServerUri=None, DiscoveryProfileUri=None, DiscoveryUrls=['opc.tcp://SNetV16:55105']), ServerCertificate=b'0\x82\x04T0\x82\x03<\xa0\x03\x02\x01\x02\x02\t\x00\x80X\x0c\xd3\xfd\x19\xbf\x0b0\r\x06\t*\x86H\x86\xf7\r\x01\x01\x0b\x05\x00081\x1d0\x1b\x06\x03U\x04\x03\x0c\x14OPC.SimaticNET.S7OPT1\x170\x15\x06\n\t\x92&\x89\x93\xf2,d\x01\x19\x16\x07SNetV160\x1e\x17\r210116154629Z\x17\r410116154629Z081\x1d0\x1b\x06\x03U\x04\x03\x0c\x14OPC.SimaticNET.S7OPT1\x170\x15\x06\n\t\x92&\x89\x93\xf2,d\x01\x19\x16\x07SNetV160\x82\x01"0\r\x06\t*\x86H\x86\xf7\r\x01\x01\x01\x05\x00\x03\x82\x01\x0f\x000\x82\x01\n\x02\x82\x01\x01\x00\xbe\xb4^\xd9\xb5\xd8\xde|\x10\xe9\xc6\xec\x9e)*\xdd\x00io\xd8\x84>h\x1c\x12\xd9\x9d\xdf\x94\x89\x13\xb2C\x93\x1dW\xdcq/\x97@5\xd5$\x0f\xcf}\xfd\xd7#\xdfY\x0e\x04\\\x12\xba?==\xa9\xddJ\xa5jd3\x11L\xc8\xbfN\xc8"+Ti\x91\xbeA\xd4\xba\xbf\xcc[\xcf\x82\x8d$Y\x88)\xb7\xd8\xf8\xf7b\xa31\x16\xf4x\x92\xfcJ\xc2C\xf3\xd4\xc1;\xd1\xc8\xbd;vr)t\x868\x8a\xe3\xb34a\xb3)\x1d\xdf\tf\x8dx\x8c\xfa\xedm\xf3\xda\xae`\xfa\x80{\xcef6\xe2o+\xab\x11\xb1!\xeaB@\x03HD\xa9\x9ap\xc8\xec\xd9\xb1\xe6=\x84\x8a\x10\x868p\x18\x956\xed\xf54\xde\xfd\x18\x9b\xb9\xd7\xac\xba\xcb\xf3i\xf1fuC\xc90\x9f\xad\x7fq\xe7VI\xb2zv\x18Z\xd4\xc1<3f\x8c\x92\xde\xe3\xd0\x9e\xd8\x1c\x8f\x95\xb0\xea\xcaT\x83F\xf6\x9ej\xc7"\xe8I\x06P\x02Z?\x18\xa3N\xc7\xc6,\xb9\xac5r\'K\x02\x03\x01\x00\x01\xa3\x82\x01_0\x82\x01[0\x0c\x06\x03U\x1d\x13\x01\x01\xff\x04\x020\x000\x0e\x06\x03U\x1d\x0f\x01\x01\xff\x04\x04\x03\x02\x02\xf40 \x06\x03U\x1d%\x01\x01\xff\x04\x160\x14\x06\x08+\x06\x01\x05\x05\x07\x03\x01\x06\x08+\x06\x01\x05\x05\x07\x03\x020,\x06\t`\x86H\x01\x86\xf8B\x01\r\x04\x1f\x16\x1dOpenSSL Generated Certificate0\x1d\x06\x03U\x1d\x0e\x04\x16\x04\x14\xe7X\xf6\xc2\xb1\xb1\n\xb8\x1a\xc4H\xff61\xe5\x83\xde\x16Vr0h\x06\x03U\x1d#\x04a0_\x80\x14\xe7X\xf6\xc2\xb1\xb1\n\xb8\x1a\xc4H\xff61\xe5\x83\xde\x16Vr\xa1<\xa4:081\x1d0\x1b\x06\x03U\x04\x03\x0c\x14OPC.SimaticNET.S7OPT1\x170\x15\x06\n\t\x92&\x89\x93\xf2,d\x01\x19\x16\x07SNetV16\x82\t\x00\x80X\x0c\xd3\xfd\x19\xbf\x0b0b\x06\x03U\x1d\x11\x04[0Y\x86Nurn:Siemens.Automation.SimaticNET.S7OPT:(B1707412-DBE3-456B-98F1-40029ACA9F7E)\x82\x07SNetV160\r\x06\t*\x86H\x86\xf7\r\x01\x01\x0b\x05\x00\x03\x82\x01\x01\x00Q\xd3_\xedP0\xd2u\t\x04\xde\xe0\xef\x00(\xd21Tz2\xb8\xa4F&\xdeWl\x9a7Q=`n\xa5&\xb8Dv\x95y\x87H\xb1\xfa\xbf\x95\xc3\x11\xb4\x06\'\xb0\xf5\x05P\xcd\xd5;x\x97:\xaf\xe8\x8f\x1d\xf2\xc1\xe3\xbb\xef\r\xac4\xadLW(\x1awm\x94\x1f]\xec]\x86\xf8\xf2\xa7b\xbd\x91\x84%\xbf\x94y@\xb5\xe9\x89\xb6\x8c\xed\xc4\xb6a\xa9\\\xf7\xc3\xf3\xa9\xd7\xfc\xec\xc8\xb1\xfc\x93\xd6\xeaRQ\xbbr\xea\xef\xe2\xc7U\xe4z]\x88\xea\xfe\x99yI\xa3\xcf\xc3\xc4\xaf\xd7\xb3%\x0c|\xb2\xea\nB\xb5\xcb\xd9\xbfE\'\xa3\x14\x96\x8e\x1c\xd84$^\x93)7>\xa2E!y\x1a\x08\xff\r\xe5\x1f\xd2\x13\xa6\x05z\xe89\x9aF\x08A#\x8b\x0ep\xedr\xa3]\x841\xb7\xbd\xdb\x93g\xc4\x0e$\xe5\x00\x11\x94j\xbc\xf9\x8c>1\x18ek\x16E\x89\x17\xe3 \xf4h\x1d\x98R\xc1I\xfa\xa1\xdaG\xef^W\xe2\xa46{s\xef\xa8\xa7\x97\x1a\r', SecurityMode=<MessageSecurityMode.SignAndEncrypt: 3>, SecurityPolicyUri='http://opcfoundation.org/UA/SecurityPolicy#Aes256_Sha256_RsaPss', UserIdentityTokens=[UserTokenPolicy(PolicyId='Anonymous', TokenType=<UserTokenType.Anonymous: 0>, IssuedTokenType=None, IssuerEndpointUrl=None, SecurityPolicyUri=None), UserTokenPolicy(PolicyId='UserName', TokenType=<UserTokenType.UserName: 1>, IssuedTokenType=None, IssuerEndpointUrl=None, SecurityPolicyUri='http://opcfoundation.org/UA/SecurityPolicy#Aes256_Sha256_RsaPss')], TransportProfileUri='http://opcfoundation.org/UA-Profile/Transport/uatcp-uasc-uabinary', SecurityLevel=125)] <MessageSecurityMode.None_: 1> 'http://opcfoundation.org/UA/SecurityPolicy#None'
INFO:asyncua.client.ua_client.UaClient:activate_session
INFO:/home/david/python/opcua/main.py:user disconnect
INFO:asyncua.client.client:disconnect
INFO:asyncua.client.ua_client.UaClient:close_session
INFO:asyncua.client.ua_client.UASocketProtocol:close_secure_channel
INFO:asyncua.client.ua_client.UASocketProtocol:Request to close socket received
INFO:asyncua.client.ua_client.UASocketProtocol:Socket has closed connection
INFO:/home/david/python/opcua/main.py:user connect
ERROR:/home/david/python/opcua/main.py:could not post <coroutine object Client.connect at 0x79c47c74bed0> since asyncio loop in thread has not been started or has been stopped
Traceback (most recent call last):
File "/home/david/python/opcua/main.py", line 30, in <module>
client.connect()
File "/home/david/python/opcua/.venv/lib/python3.12/site-packages/asyncua/sync.py", line 110, in wrapper
result = self.tloop.post(aio_func(*args, **kwargs))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/david/python/opcua/.venv/lib/python3.12/site-packages/asyncua/sync.py", line 64, in post
raise ThreadLoopNotRunning(f"could not post {coro} since asyncio loop in thread has not been started or has been stopped")
asyncua.sync.ThreadLoopNotRunning: could not post <coroutine object Client.connect at 0x79c47c74bed0> since asyncio loop in thread has not been started or has been stopped
/home/david/python/opcua/main.py:33: RuntimeWarning: coroutine 'Client.connect' was never awaited
logger.exception(err)
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
Traceback (most recent call last):
File "/home/david/python/opcua/.venv/lib/python3.12/site-packages/asyncua/sync.py", line 257, in disconnect
self.tloop.post(self.aio_obj.disconnect())
File "/home/david/python/opcua/.venv/lib/python3.12/site-packages/asyncua/sync.py", line 64, in post
raise ThreadLoopNotRunning(f"could not post {coro} since asyncio loop in thread has not been started or has been stopped")
asyncua.sync.ThreadLoopNotRunning: could not post <coroutine object Client.disconnect at 0x79c47c6720c0> since asyncio loop in thread has not been started or has been stopped
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/david/python/opcua/main.py", line 36, in <module>
client.disconnect()
File "/home/david/python/opcua/.venv/lib/python3.12/site-packages/asyncua/sync.py", line 260, in disconnect
self.tloop.stop()
File "/home/david/python/opcua/.venv/lib/python3.12/site-packages/asyncua/sync.py", line 58, in stop
self.loop.call_soon_threadsafe(self.loop.stop)
File "/usr/lib/python3.12/asyncio/base_events.py", line 840, in call_soon_threadsafe
self._check_closed()
File "/usr/lib/python3.12/asyncio/base_events.py", line 541, in _check_closed
raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed
sys:1: RuntimeWarning: coroutine 'Client.disconnect' was never awaited
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
Version:
$ pip show asyncua
Name: asyncua
Version: 1.1.5
Summary: Pure Python OPC-UA client and server library
Home-page: http://freeopcua.github.io/
Author: Olivier Roulet-Dubonnet
Author-email: [email protected]
License: GNU Lesser General Public License v3 or later
Location: /home/david/python/opcua/.venv/lib/python3.12/site-packages
Requires: aiofiles, aiosqlite, cryptography, pyOpenSSL, python-dateutil, pytz, sortedcontainers, typing-extensions
Required-by:
$ uname -a
Linux DevLaptop 6.8.0-45-generic #45-Ubuntu SMP PREEMPT_DYNAMIC Fri Aug 30 12:02:04 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
The text was updated successfully, but these errors were encountered:
I have a simple program that uses
asyncua.sync.Client
. The program simply connects to the server, disconnects, then re-connects. When attempting the second connect (or re-connect) I get an error.The code:
The output:
Version:
The text was updated successfully, but these errors were encountered: