Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Trying out the last snippet. What am I doing wrong here? Python 3.7.7

https://pastebin.com/E9KWCmky



Indentation is wrong in following statement ``` return once_wrapper ```


Duh, thanks! Now I have a new one but I think it just means the script needs to stay running longer so the coroutine can have time to do its thing.

    ./once.py:29: RuntimeWarning: coroutine 'once.
    <locals>.once_wrapper' was never awaited
    one_time_setup()


Your main function needs to be async as well, since the one_time_setup is async. Linking this SO answer that also links to the docs (may come handy!).

https://stackoverflow.com/questions/57399157/runtimewarning-...

Edit: Also tangentially relevant is the article linked by pansa2 in another thread, which was also discussed on HN a few months ago: http://journal.stuffwithstuff.com/2015/02/01/what-color-is-y...


Thanks!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: