Skip to content

Commit 64bf553

Browse files
committed
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 <misanjum@linux.vnet.ibm.com>
1 parent 339f2a8 commit 64bf553

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

tools/perf/scripts/python/export-to-sqlite.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -79,16 +79,15 @@
7979
# difference is the 'transaction' column of the 'samples' table which is
8080
# renamed 'transaction_' in sqlite because 'transaction' is a reserved word.
8181

82-
PYSIDE_VERSION_1 = True
83-
if "pyside-version-1" not in sys.argv:
84-
try:
85-
from PySide2.QtSql import *
86-
PYSIDE_VERSION_1 = False
87-
except:
88-
pass
89-
90-
if PYSIDE_VERSION_1:
82+
# Import PySide based on Python Version
83+
if "pyside-version-1" in sys.argv or "--pyside-version-1" in sys.argv \
84+
or sys.version_info < (2,7):
9185
from PySide.QtSql import *
86+
else:
87+
if sys.version_info >= (3,7):
88+
from PySide6.QtSql import *
89+
else:
90+
from PySide2.QtSql import *
9291

9392
sys.path.append(os.environ['PERF_EXEC_PATH'] +
9493
'/scripts/python/Perf-Trace-Util/lib/Perf/Trace')

0 commit comments

Comments
 (0)