I'm having trouble fixing and understanding the problem here. I'm using an example to learn Asyncio but the code I'm using is similar to mine but mine gives an error message saying:
sys:1: RuntimeWarning: coroutine 'run_script' was never awaited
Please any help will be greatly appreciated. Below is my code
async def run_script(script): print("Run", script) await asyncio.sleep(1) os.system("python " + script) and I'm running it like this
for script in os.listdir(): if script.endswith(".py"): scripts.append(run_script(script)) loop = asyncio.get_event_loop() loop.run_until_complete(asyncio.gather(scripts)) loop.close()
scriptswhen passing it togather:asyncio.gather(*scripts).