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

Just use

  if not API_KEY:
    sys.exit("Missing YOUTUBE_API_KEY.")

It will print message to sys.stderr and do system exit with code 1.

P.S. exit() is just an alias to sys.exit(), I prefer longer form.



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

Search: