From 4e39bdded0aa684bc0de6b1338a72a4b9ef78f4d Mon Sep 17 00:00:00 2001 From: Lukasz Janyst Date: Sun, 3 Feb 2019 19:39:00 +0100 Subject: [PATCH] Check for the Python version and fail if using Python 2 --- detect.py | 4 ++++ export_model.py | 4 ++++ infer.py | 4 ++++ process_dataset.py | 4 ++++ train.py | 4 ++++ 5 files changed, 20 insertions(+) diff --git a/detect.py b/detect.py index 7f96fae..ad9274e 100755 --- a/detect.py +++ b/detect.py @@ -31,6 +31,10 @@ from utils import draw_box from tqdm import tqdm +if sys.version_info[0] < 3: + print("This is a Python 3 program. Use Python 3 or higher.") + sys.exit(1) + #------------------------------------------------------------------------------- # Start the show #------------------------------------------------------------------------------- diff --git a/export_model.py b/export_model.py index bdc3e23..5b53072 100755 --- a/export_model.py +++ b/export_model.py @@ -27,6 +27,10 @@ from tensorflow.python.framework import graph_util +if sys.version_info[0] < 3: + print("This is a Python 3 program. Use Python 3 or higher.") + sys.exit(1) + #--------------------------------------------------------------------------- # Parse the commandline #--------------------------------------------------------------------------- diff --git a/infer.py b/infer.py index 1d014c1..ce76955 100755 --- a/infer.py +++ b/infer.py @@ -36,6 +36,10 @@ from utils import str2bool, load_data_source, draw_box from tqdm import tqdm +if sys.version_info[0] < 3: + print("This is a Python 3 program. Use Python 3 or higher.") + sys.exit(1) + #------------------------------------------------------------------------------- def sample_generator(samples, image_size, batch_size): image_size = (image_size.w, image_size.h) diff --git a/process_dataset.py b/process_dataset.py index 664e743..19d4a69 100755 --- a/process_dataset.py +++ b/process_dataset.py @@ -32,6 +32,10 @@ from utils import load_data_source, str2bool, draw_box from tqdm import tqdm +if sys.version_info[0] < 3: + print("This is a Python 3 program. Use Python 3 or higher.") + sys.exit(1) + #------------------------------------------------------------------------------- def annotate(data_dir, samples, colors, sample_name): """ diff --git a/train.py b/train.py index 2677dda..49410f3 100755 --- a/train.py +++ b/train.py @@ -35,6 +35,10 @@ from utils import * from tqdm import tqdm +if sys.version_info[0] < 3: + print("This is a Python 3 program. Use Python 3 or higher.") + sys.exit(1) + #------------------------------------------------------------------------------- def compute_lr(lr_values, lr_boundaries): with tf.variable_scope('learning_rate'):