[PyQt] Pyqt5.9 MySQL driver not loaded

gj at hd-doc.com gj at hd-doc.com
Thu Aug 3 10:13:00 BST 2017


Problem solved by adding Mysql driver files libmysql.dll
libmysql.lib to the project source.
I still can’t debug PYQT5.QTSQL, do I need to rebuild from the source? Why doesn’t installation from the wheel install with debug information or have I missed something?

Kind regards
Gert

From: gj at hd-doc.com
Sent: 30. juli 2017 23:28
To: pyqt at riverbankcomputing.com
Subject: Pyqt5.9 MySQL driver not loaded


Why is the MySQL driver not loaded when it’s available in C:\Python36\Lib\site-packages\PyQt5\Qt\plugins\sqldrivers\qsqlmysql.dll and print(db.isDriverAvailable('QMYSQL'))
Returns True.
The setup is win10, Python 3.6.2 and installing the latest wheel Pyqt5.9.1 and SIP 4.19.3 by Pip 9.01.  Hope someone can help me solving this time consuming problem finding and no solutions.
The Code:
# coding=utf-8
from PyQt5.QtWidgets import QMessageBox
from PyQt5 import QtSql
def createconnection():
db = QtSql.QSqlDatabase.addDatabase('MYSQL')
print(db.isDriverAvailable('QMYSQL'))
db.setHostName("192.168.1.225")
db.setPort(3306)
db.setDatabaseName("Database_dispo_4")
db.setUserName("T3")
db.setPassword("xxxx")
print(db.open())
print(db.lastError().text())
print(db.drivers()


Consol output
C:\Python36\python.exe "C:\Program Files\JetBrains\PyCharm 2017.2\helpers\pydev\pydevd.py" --multiproc --qt-support=auto --client 127.0.0.1 --port 54371 --file C:/Users/Doc/Documents/Pyqt_SQL/src/Qtabwindow.py
pydev debugger: process 4020 is connecting

Connected to pydev debugger (build 172.3317.103)
True
False
Driver not loaded Driver not loaded
['QSQLITE', 'QMYSQL', 'QMYSQL3', 'QODBC', 'QODBC3', 'QPSQL', 'QPSQL7']

Kind regards
Gert Jorgensen


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20170803/ed3962f9/attachment.html>


More information about the PyQt mailing list