Skip to content

Instantly share code, notes, and snippets.

@linusthe3rd
Created July 20, 2015 19:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save linusthe3rd/432c8354d293d1ad4713 to your computer and use it in GitHub Desktop.
Save linusthe3rd/432c8354d293d1ad4713 to your computer and use it in GitHub Desktop.
Check if Import/Dependency is Available at Runtime
from __future__ import print_function
// ...other dependencies...
try:
import requests
except ImportError:
print('You must install the "requests" package in order to use '
'the sync writer: `pip install requests`')
import sys
sys.exit(1)
// ... main module code ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment