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
TBH I'm not quite sure how to implement this, since I'm using already using my own asyncio loop in my application.
Since It's using loop.run_until_complete in pymodbus/client/async/factory/tcp.py#L97, it would start a new loop on its own, which is not desirable and leads to a Runtime Exception. IMO it should give the option to attach to a loop that's already running.
Code and Logs
Task exception was never retrieved
future: <Task finished coro=<BAS.async_start() done, defined at /srv/bas/lib/python3.5/site-packages/bas/core.py:70> exception=RuntimeError('This event loop is already running',)>
Traceback (most recent call last):
File "/usr/lib/python3.5/asyncio/tasks.py", line 239, in _step
result = coro.send(None)
File "/srv/bas/lib/python3.5/site-packages/bas/core.py", line 72, in async_start
await neuron.switch_to_async(self.loop, self.basConfig.alias_dict)
File "/srv/bas/lib/python3.5/site-packages/bas/brain.py", line 141, in createClient
loopi, clienti = ModbusClient(schedulers.ASYNC_IO, host=self.modbus_server, port=self.modbus_port, loop=self.loop)
File "/srv/bas/lib/python3.5/site-packages/pymodbus/client/async/tcp.py", line 45, in __new__
timeout=timeout, **kwargs)
File "/srv/bas/lib/python3.5/site-packages/pymodbus/client/async/factory/tcp.py", line 97, in async_io_factory
client = loop.run_until_complete(asyncio.gather(cor))[0]
File "/usr/lib/python3.5/asyncio/base_events.py", line 454, in run_until_complete
self.run_forever()
File "/usr/lib/python3.5/asyncio/base_events.py", line 408, in run_forever
raise RuntimeError('This event loop is already running')
RuntimeError: This event loop is already running
The text was updated successfully, but these errors were encountered:
Versions
Pymodbus Specific
Description
Reported by @makuser in #246 (comment)
TBH I'm not quite sure how to implement this, since I'm using already using my own asyncio loop in my application.
Since It's using loop.run_until_complete in pymodbus/client/async/factory/tcp.py#L97, it would start a new loop on its own, which is not desirable and leads to a Runtime Exception. IMO it should give the option to attach to a loop that's already running.
Code and Logs
The text was updated successfully, but these errors were encountered: