Skip to content

Instantly share code, notes, and snippets.

@linusthe3rd
Created July 20, 2015 19:29
Show Gist options
  • 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