If your users are installing your software via wheel (or sdist)
packages, you can set the Requires-Python metadata to >=3.8 and then
users will get an error while trying to install your software on too
old of a version of the CPython interpreter.
In that case, another option is to make what your users run a simple
script that works in Python 3.7 and checks to see if the version is
older than 3.8. That way it can express your error message at
runtime and only then imports and calls into your real module if
everything checks out.
The available solutions are fairly obvious, so long as you keep in
mind that there is no way for code which isn’t supported in a given
version of Python to provide a meaningful error controlled by you
when run under that version of Python.
Ensure that this version check is done in a file that doesn’t use, or import something that uses, the operator. The simplest way is to have the driver code do this check before importing the main functionality, and only doing that. For example, something like
if sys.hexversion < 0x03080000:
print("Sorry, requires Python 3.8 or above")
print("You can read more at: https://sabnzbd.org/wiki/installation/install-off-modules")
if __name__ == '__main__':