The proper way of doing asyncio in Houdini 20's python node?

   261   0   2
User Avatar
Member
3 posts
Joined: March 2017
Offline
In houdini 19.5, I can define async functions and invoke with asyncio.new_event_loop().run_until_complete(async_task())in python node

But in houdini 20, this yields error:

  File "C:\Program Files/Side Effects Software/Houdini 20.0.688/houdini/python3.10libs\haio.py", line 2101, in run_until_complete
    self.run_forever()
  File "C:\Program Files/Side Effects Software/Houdini 20.0.688/houdini/python3.10libs\haio.py", line 2079, in run_forever
    assert not self._isUIAvailable()
AssertionError

I've also tried to call asyncio.run(async_task())directly, and following error was raised:

  File "D:\Program Files\Side Effects Software\Houdini 20.0.688\python310\lib\asyncio\runners.py", line 33, in run
raise RuntimeError(
RuntimeError: asyncio.run() cannot be called from a running event loop

Is it still possible to do async things in python node for Houdini 20? And what's the proper way?
  • Quick Links