Skip to content

Commit

Permalink
Fix PySide import error for perf script: export-to-sqlite.py
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
misanjumn committed Aug 18, 2023
1 parent 339f2a8 commit 2d94c2a
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions tools/perf/scripts/python/export-to-sqlite.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'] +
Expand Down

0 comments on commit 2d94c2a

Please sign in to comment.