Skip to content

Commit

Permalink
Fix PySide import error for perf script: export-to-postgresql.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 16, 2023
1 parent 432d823 commit fe3e0e6
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions tools/perf/scripts/python/export-to-postgresql.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,15 +223,14 @@
# print "{0:>6} {1:>10} {2:>9} {3:<30} {4:>6} {5:<30}".format(query.value(0), query.value(1), query.value(2), query.value(3), query.value(4), query.value(5))
# call_path_id = query.value(6)

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" in sys.argv:
from PySide.QtSql import *
elif sys.version_info >= (3,7):
from PySide6.QtSql import *
elif sys.version_info >= (3,0):
from PySide2.QtSql import *
else:
from PySide.QtSql import *

if sys.version_info < (3, 0):
Expand Down

0 comments on commit fe3e0e6

Please sign in to comment.