Issue connecting python with KEPServerEX 6 #1348
Unanswered
AndresParra11
asked this question in
Q&A
Replies: 1 comment 8 replies
-
Security None just the secruity of the communication. You maybe still need a useser + password or a certificate, to login. That is what the errorcode BadIdentityTokenInvalid means. |
Beta Was this translation helpful? Give feedback.
8 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
In KEPServerEX 6 I have the following configuration (OPC UA Configuration Manager):
In device 1 channel 1, I have two tags to test the connection:
I have Python 3.11 installed and I'm using Visual Studio Code (VSC). I already installed the asyncua library with the "pip install asyncua" command from the VSC terminal. And I have the following code:
And it throws me the following errors:
Requested session timeout to be 3600000ms, got 60000ms instead
ServiceFault (BadIdentityTokenInvalid, diagnostics: DiagnosticInfo(SymbolicId=None, NamespaceURI=None, Locale=None, LocalizedText=None, AdditionalInfo=None, InnerStatusCode=None, InnerDiagnosticInfo=None)) from server received in response to ActivateSessionRequest
Traceback (most recent call last):
File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\asyncua\client\client.py", line 291, in connect
await self.activate_session(username=self._username, password=self._password, certificate=self.user_certificate)
File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\asyncua\client\client.py", line 600, in activate_session
return await self.uaclient.activate_session(params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\asyncua\client\ua_client.py", line 339, in activate_session
data = await self.protocol.send_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\asyncua\client\ua_client.py", line 165, in send_request
self.check_answer(data, f" in response to {request.class.name}")
File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\asyncua\client\ua_client.py", line 174, in check_answer
hdr.ServiceResult.check()
File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\asyncua\ua\uatypes.py", line 372, in check
raise UaStatusCodeError(self.value)
asyncua.ua.uaerrors._auto.BadIdentityTokenInvalid: "The user identity token is not valid."(BadIdentityTokenInvalid)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:\Users\user\Downloads\Prueba OPC\tempCodeRunnerFile.py", line 17, in
asyncio.run(main())
File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\asyncio\runners.py", line 190, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\asyncio\runners.py", line 118, in run
return self._loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\asyncio\base_events.py", line 653, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "c:\Users\user\Downloads\Prueba OPC\tempCodeRunnerFile.py", line 7, in main
await client.connect()
File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\asyncua\client\client.py", line 294, in connect
await self.close_session()
File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\asyncua\client\client.py", line 672, in close_session
return await self.uaclient.close_session(True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\asyncua\client\ua_client.py", line 362, in close_session
response.ResponseHeader.ServiceResult.check()
File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\asyncua\ua\uatypes.py", line 372, in check
raise UaStatusCodeError(self.value)
asyncua.ua.uaerrors._auto.BadSessionNotActivated: "The session cannot be used because ActivateSession has not been called."(BadSessionNotActivated)
I don't know what to do, if you can help me I appreciate it.
Beta Was this translation helpful? Give feedback.
All reactions