From 2d94c2a93be0564dd657eb1a239c517ec9db2c97 Mon Sep 17 00:00:00 2001 From: Misbah Anjum N Date: Fri, 18 Aug 2023 17:11:29 +0530 Subject: [PATCH] Fix PySide import error for perf script: export-to-sqlite.py PySide and PySide2 are not supported for Python3.7 and above Based on Python version, different PySide versions can be imported PySide6 should be imported in case of Python3.7 and above Signed-off-by: Misbah Anjum N --- tools/perf/scripts/python/export-to-sqlite.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/tools/perf/scripts/python/export-to-sqlite.py b/tools/perf/scripts/python/export-to-sqlite.py index 63ef27be7af06b..526cb66229c99a 100644 --- a/tools/perf/scripts/python/export-to-sqlite.py +++ b/tools/perf/scripts/python/export-to-sqlite.py @@ -79,15 +79,14 @@ # difference is the 'transaction' column of the 'samples' table which is # renamed 'transaction_' in sqlite because 'transaction' is a reserved word. -PYSIDE_VERSION_1 = True -if "pyside-version-1" not in sys.argv: - try: - from PySide2.QtSql import * - PYSIDE_VERSION_1 = False - except: - pass - -if PYSIDE_VERSION_1: +# Import PySide based on Python Version +if "pyside-version-1" or "--pyside-version-1" in sys.argv: + from PySide.QtSql import * +elif sys.version_info >= (3,7): + from PySide6.QtSql import * +elif sys.version_info >= (2,7): + from PySide2.QtSql import * +else: from PySide.QtSql import * sys.path.append(os.environ['PERF_EXEC_PATH'] +