import asyncio import logging async def sleepWithShell(loop): process = await asyncio.create_subprocess_shell("sleep 2", loop=loop) await process.wait() return True def main(): logging.basicConfig(level=logging.DEBUG) loop = asyncio.new_event_loop() result =loop.run_until_complete(sleepWithShell(loop)) loop.close() print(result) if __name__ == "__main__": main()