Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python2 is not supported
#1
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?
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#2
I would raise a RuntimeError
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply
#3
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.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  python2 python3 messed up : How to fix ? hary 15 14,182 Dec-30-2020, 08:26 PM
Last Post: hary
  using pudb on python2 code ErnestTBass 2 2,965 Aug-10-2020, 08:12 PM
Last Post: snippsat
  Trying to run a python2 script dagamer1991 3 4,014 Aug-12-2019, 12:33 PM
Last Post: buran
  python2.7 executables thus the system python2.7 was erroring utility.execute()? vivekm 1 2,719 May-20-2019, 11:24 AM
Last Post: vivekm
  Problem in a python2 file sylas 15 12,144 Aug-08-2018, 08:54 AM
Last Post: sylas
  byte string in python2 Skaperen 4 6,082 Nov-23-2017, 03:13 AM
Last Post: Skaperen
  Different outputs in Python2 and Python3 MikeHill 3 5,808 Jun-07-2017, 08:58 PM
Last Post: Ofnuts

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020
This forum uses Lukasz Tkacz MyBB addons.
Forum use Krzysztof "Supryk" Supryczynski addons.