[PyQt] QtSql connection fail where psycopg2 success?

Andreas Pakulat apaku at gmx.de
Wed Jan 11 12:24:59 GMT 2012


On 11.01.12 18:55:43, Panupat Chongstitwattana wrote:
> Thanks Andreas.
> 
> You're right I used windows binary installer. I don't seem to have the
> postgresql.dll anywhere, nor can I find the Qt installation folder : /

Sorry, should've mentioned that the filename was made up, no idea how
its called on Windows. And as I said I also don't know the layout of the
PyQt binary packages, so no idea what is to be considered the "Qt"
directory or wether such a thing exists at all in the binary package.

> Following your suggestion, lastError indead tells me drivers are not
> loaded. But what makes me really confuse is that none of the drivers are
> loading at all.
> 
> QtSql.QSqlDatabase.isDriverAvailable('QPSQL')
> QtSql.QSqlDatabase.isDriverAvailable('QMYSQL')
> QtSql.QSqlDatabase.isDriverAvailable('QSQLITE')
> 
> all returns False.
> 
> I tried download and install the latest binary package but still same
> problem.

As even sqlite fails, that probably means the plugin is not found at
all. Try adding C:\Python26\Lib\site-packages\PyQt4 to PATH.

Also check what  QSqlDataBase.drivers() returns?

Andreas



More information about the PyQt mailing list