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
Under the covers, these functions manage an async event loop. Functions that are suitable for use in an async function is a work in progress. I'm glad to hear there is interest.
With #71, your example program can be changed to what follows to use with asyncio:
fromtnz.tnzimportTnzimportasyncioasyncdefmain():
event=asyncio.Event()
tnz=Tnz()
tnz.connect("s390vm", event=event)
awaitevent.wait()
event.clear() # set up to re-use eventprint(tnz.scrstr(rstrip=True))
tnz.close()
asyncio.run(main())
Note that tnz will call event.set() for every update from the server. To re-use it, use event.clear() after the await as noted above.
Note that Tnz.wait()cannot be used for this use case. And Tnz provides low-level APIs while Ati provides high-level APIs. But there are not yet any high-level APIs that can be used in this manner (in an asyncio event loop).
Description
tnz
fails withRuntimeError: This event loop is already running
as soon as there's an event loop used by any other code.How to reproduce
Just try to call
Tnz.wait
in any combination with async code. See the simple example below.The text was updated successfully, but these errors were encountered: