From dc510c71e376dc5a9ca28b54d6668573631734e6 Mon Sep 17 00:00:00 2001 From: Louis Vézina <5130500+morpheus65535@users.noreply.github.com> Date: Thu, 5 Sep 2019 11:30:14 -0400 Subject: Added a check for Python version. --- bazarr.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'bazarr.py') diff --git a/bazarr.py b/bazarr.py index 5e559fe03..17fc44cdf 100644 --- a/bazarr.py +++ b/bazarr.py @@ -4,10 +4,27 @@ import subprocess as sp import time import os import sys +import platform -from bazarr import libs from bazarr.get_args import args + +def check_python_version(): + python_version = platform.python_version_tuple() + minimum_python_version_tuple = (2, 7, 13) + minimum_python_version = ".".join(str(i) for i in minimum_python_version_tuple) + + if int(python_version[0]) > minimum_python_version_tuple[0]: + print "Python 3 isn't supported. Please use Python " + minimum_python_version + " or greater." + os._exit(0) + + elif int(python_version[1]) < minimum_python_version_tuple[1] or int(python_version[2]) < minimum_python_version_tuple[2]: + print "Python " + minimum_python_version + " or greater required. Current version is " + platform.python_version() + ". Please upgrade Python." + os._exit(0) + + +check_python_version() + dir_name = os.path.dirname(__file__) -- cgit v1.2.3