Created
July 20, 2015 19:29
-
-
Save linusthe3rd/432c8354d293d1ad4713 to your computer and use it in GitHub Desktop.
Check if Import/Dependency is Available at Runtime
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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