Python Forum

Full Version: Python2 is not supported
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
i am now writing most of my scripts for Python3. is it reasonable to test which version of python is actually running and search for Python3 and if found, re-run the script under the intended version of python?

if not, then is it reasonable to raise an exception (instead of exiting with a status code)? if so, what class of exception should i raise?
I would raise a RuntimeError
If your code only supports python 3, the python version is not something it should be checking at all.

Instead, specify the python 3 requirement in your setup.py, mention it in your readme, mention it in your docs.
That should be enough. If people still try using it with python 2, it's their problem.