What's the appropriate built-in Exception to raise if your library is used with the wrong Python Version? -
i have simple library distributed .py file. raise exception if library called 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 using python 3 instead of python 2')
what built-in exception should raise? (how fill in blank above?) closest exception can find among builtin exceptions notimplementederror. deprecationwarning feels close, exception more appropriate in case.
i'd use runtimeerror
this; there no more specific exception.
Comments
Post a Comment