[PyQt] ANN: PyQt v5.8 and SIP v4.19.1 Released
Sibylle Koczian
nulla.epistola at web.de
Fri Feb 17 14:11:14 GMT 2017
Am 15.02.2017 um 19:07 schrieb Phil Thompson:
> PyQt v5.8 and SIP v4.19.1 have been released. There are also new releases of PyQt3D, PyQtChart, PyQtDataVisualization and PyQtPurchasing.
>
> The highlight of the release is support for Qt v5.8.0.
>
I repeat my mail from last November, because nothing has changed with
PyQt 5.8 and Python 3.6. Same OS, same PostgreSQL version. I never got
an answer then, so I try again:
I can't get the QPSQL driver to work any more.
Versions of everything: OS is Windows 10, Python 3.5.2, PostgreSQL
9.6.1, PyQt 5.7 installed from PyPi, all of it 64 bit.
This has worked before. I suspect the recent PostgreSQL upgrade from 9.5
to 9.6, is that possible? Or the change from PyQt5 5.6 (Windows binaries
from the Riverbank website) to 5.7 (wheels from PyPi)? The database
driver dlls are present in the ...\Qt\plugins\sqldrivers of my PyQt5
installation. Moreover I can connect to MSSql using ODBC and to MariaDB.
Something just possibly related:
When I install PyQt5 on Linux (Debian, Ubuntu) I need to include not
only the package python3-pyqt5.qtsql, but additionally packages like
libqt5sql5-psql for Postgresql, -odbc, -mysql etc. Only the -sqlite
package is installed automatically with python3-pyqt5.qtsql, I think.
So could the copy of LGPL Qt included in the wheel miss the part
necessary for PostgreSQL?
Script to show the problem and compare with Sqlite:
------------------------------------------------------------
#!/usr/bin/env python
import sys
from PyQt5 import QtCore
from PyQt5 import QtSql
def checkQPSQL():
result = QtSql.QSqlDatabase.isDriverAvailable('QPSQL')
print("PostgreSQL-Treiber verfügbar? {}".format(result))
db = QtSql.QSqlDatabase.addDatabase("QPSQL", "postgresql")
cname = db.connectionName()
print("db.connectionName() = ", cname)
print("db.lastError:", db.lastError().text())
db.setDatabaseName("sib")
db.setHostName("localhost")
db.setUserName("sib")
db.setPassword("immergut")
result = db.open()
print("Datenbank geöffnet? {}".format(result))
db.close()
if result:
if db.isOpen():
print("Datenbank konnte nicht geschlossen werden.")
print(db.lastError().text())
else:
print("Datenbank geschlossen.")
QtSql.QSqlDatabase.removeDatabase(cname)
def checkQSQLITE():
result = QtSql.QSqlDatabase.isDriverAvailable('QSQLITE')
print("Sqlite-Treiber verfügbar? {}".format(result))
db = QtSql.QSqlDatabase.addDatabase("QSQLITE", "sqlite")
cname = db.connectionName()
print("db.connectionName() = ", cname)
print("db.lastError:", db.lastError().text())
result = db.open()
print("Datenbank geöffnet? {}".format(result))
db.close()
if result:
if db.isOpen():
print("Datenbank konnte nicht geschlossen werden.")
print("db.lastError:", db.lastError().text())
else:
print("Datenbank geschlossen.")
QtSql.QSqlDatabase.removeDatabase(cname)
if __name__ == "__main__":
app = QtCore.QCoreApplication(sys.argv[1:])
dbliste = QtSql.QSqlDatabase.drivers()
print(dbliste)
print("-----")
checkQPSQL()
print("-----")
checkQSQLITE()
------------------------------------------------------------------------
Output (copied from command window):
['QSQLITE', 'QMYSQL', 'QMYSQL3', 'QODBC', 'QODBC3', 'QPSQL', 'QPSQL7']
-----
PostgreSQL-Treiber verfügbar? True
QSqlDatabase: QPSQL driver not loaded
QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QODBC QODBC3
QPSQL QPSQL7
db.connectionName() = postgresql
db.lastError: Driver not loaded Driver not loaded
Datenbank geöffnet? False
QSqlDatabasePrivate::removeDatabase: connection 'postgresql' is still in
use, all queries will cease to work.
-----
Sqlite-Treiber verfügbar? True
db.connectionName() = sqlite
db.lastError:
Datenbank geöffnet? True
QSqlDatabasePrivate::removeDatabase: connection 'sqlite' is still in
use, all queries will cease to work.
--------------------------------------------------------------------------
Additional question: if I start this script from an IDE (IDLE or Wing)
the error messages starting with "QsqlDatabase:", "QSqlDatabasePrivate:"
don't appear. What's that?
Thank you for any sort of help,
Sibylle
More information about the PyQt
mailing list