I have used asyncua Library to get the data from OPC server. This is the simple example of the code I have used in the application, I am getting these error randomly.
Describe the bug
Calling connect() after disconnect() will raise ThreadLoopNotRunning error.
To Reproduce
>>> client = Client('opc.tcp://localhost')
>>> client.connect()
>>> client.disconnect()
>>> client.connect()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/user/project/venv/lib/python3.10/site-packages/asyncua/sync.py", line 95, in wrapper
result = self.tloop.post(aio_func(*args, **kwargs))
File "/home/user/project/venv/lib/python3.10/site-packages/asyncua/sync.py", line 51, in post
raise ThreadLoopNotRunning(f"could not post {coro}")
asyncua.sync.ThreadLoopNotRunning: could not post <coroutine object Client.connect at 0x7faf0b51ace0>
In library The asynchorous method is used (async/await) but In my application I am used these await/async methods. Is these a possible reason for above error or anything else?
The library has a current limitation that you need a new client for each connect.
There is a open issue https://github.com/FreeOpcUa/opcua-asyncio/issues/1364