Python Forum
Python2 is not supported - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Python2 is not supported (/thread-16466.html)



Python2 is not supported - Skaperen - Mar-01-2019

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?


RE: Python2 is not supported - ichabod801 - Mar-01-2019

I would raise a RuntimeError


RE: Python2 is not supported - stranac - Mar-01-2019

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.