Files
LibreQoS/src/pythonCheck.py
Herbert Wolverson f8f438e8d7 Add Python Version Check to Python Scripts
ISSUE #204 : Running on versions prior to 3.10 will fail, due to
the use of `match` statements. Other parts of the script assume
a recent Python also, and the system as a whole expects a recent
version of Ubuntu.

`pythonCheck.py` polls `sys.version_info` to detect the in-use
version of Python. If the version is prior to 3.10, it bails out
with the message "LibreQoS requires Python 3.10 or greater".

This should help with outdated OS detection in general.
2023-02-15 15:00:53 +00:00

14 lines
408 B
Python

import os
def checkPythonVersion():
# Perform a version check
import sys
print("Running Python Version " + sys.version)
version_ok = True
if sys.version_info[0] < 3:
version_ok = False
if sys.version_info[0]==3 and sys.version_info[1] < 10:
version_ok = False
if version_ok == False:
print("LibreQoS requires Python 3.10 or greater.")
os._exit(-1)