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
After calling that select, all asyncio commands would fail. Here is a demo to reproduce the issue. The 1st 2 pinghosts call works but not after the inquirer.select
Traceback (most recent call last):
File "./demo.py", line 25, in
print( pinghosts(['box20', 'box1d2', 'box21']) )
File "./demo.py", line 16, in pinghosts
results = asyncio.get_event_loop().run_until_complete( asyncio.gather( *jobs ) )
File "/usr/lib64/python3.8/asyncio/events.py", line 639, in get_event_loop
raise RuntimeError('There is no current event loop in thread %r.'
RuntimeError: There is no current event loop in thread 'MainThread'.
Is this my bug or a bug in how inquirer.select().exeute() operates ?
The text was updated successfully, but these errors were encountered:
def pinghosts(hosts):
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
jobs = (run_command(*((f'ping -c1 -W1 {host}').split()), host=host) for host in hosts)
results = loop.run_until_complete( asyncio.gather( *jobs ) )
return results
However, I'm not confident of this workaround. It would be better if inquirer call would leave the event loop running unless it created its own event loop.
I ran into a problem where calling this.
After calling that select, all asyncio commands would fail. Here is a demo to reproduce the issue. The 1st 2 pinghosts call works but not after the inquirer.select
it fails with this
Traceback (most recent call last):
File "./demo.py", line 25, in
print( pinghosts(['box20', 'box1d2', 'box21']) )
File "./demo.py", line 16, in pinghosts
results = asyncio.get_event_loop().run_until_complete( asyncio.gather( *jobs ) )
File "/usr/lib64/python3.8/asyncio/events.py", line 639, in get_event_loop
raise RuntimeError('There is no current event loop in thread %r.'
RuntimeError: There is no current event loop in thread 'MainThread'.
Is this my bug or a bug in how inquirer.select().exeute() operates ?
The text was updated successfully, but these errors were encountered: