Created
January 13, 2022 09:37
-
-
Save pkutaj/f4d2a0821b80a38027f34fe679647b84 to your computer and use it in GitHub Desktop.
Snippet to print missing module error instead of Traceback with ModuleNotFoundError
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
moduleMissingError = 'Missing dependency module: Run "pip install -r requirements.txt" → Retry' | |
try: | |
import #<module1> | |
import #<package2> | |
import #<subpackage1> | |
except ImportError: | |
sys.exit(moduleMissingError) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment