I have a simple library distributed as a .py file. I would like to throw an exception if the library is called from Python 2 instead of Python 3:
def _check_version():
if sys.version_info < (3,):
raise _____Exception('This library depends on Python 3 strings. Please ensure you are using Python 3 instead of Python 2')
What built-in exception should I raise? (How to fill in the blank above?) The closest exception I can find among builtin Exceptions is NotImplementedError. DeprecationWarning feels close, but an exception is more appropriate in this case.
source
share