lorien/runscript

Can't run async script

offline opened this issue · 3 comments

If main function is a coroutine - it will be never executed

example:

async def main(*args, **kwargs):
    loop = asyncio.get_event_loop()
    redis = loop.run_until_complete(get_redis_pool(loop))
    keys = await redis.keys("moments:*")
    print(keys)

prints: RuntimeWarning: coroutine 'main' was never awaited

http://stackoverflow.com/questions/36076619/test-if-function-or-method-is-normal-or-asynchronous

@offline Why do you want main function to be async?

because you can only use await keyword only inside async function

Can you just touch me in skype regarding this? :)