[PyQt] QtSql connection fail where psycopg2 success?

Andreas Pakulat apaku at gmx.de
Wed Jan 11 11:18:56 GMT 2012


On 11.01.12 18:03:52, Panupat Chongstitwattana wrote:
> Where is Qt's plugin folder? I can only find this

Whereever you installed Qt. If you took the PyQt4 windows binary
package, then I don't know :|

> C:\Python26\Lib\site-packages\PyQt4\plugins\sqldrivers
> 
> It has 4 files in it.
> 
> qsqlite4.dll
> qsqlmysql4.dll
> qsqlodbc4.dll
> qsqlpsql4.dll

That looks good, now you just need to ensure that the postgresql dll is
also in your PATH when starting python so the qsqlpsql4.dll can find it.

If thats also the case and its still not working, I'd suggest to check
wether Qt really supports the driver via
QSqlDataBase.isDriverAvailable(). You may also have some luck with
checking isValid() after the addDatabase and maybe the lastError()
function to get a proper message out.

Andreas



More information about the PyQt mailing list