[PyQt] no SQL Drivers available (Gentoo-Linux)

Ulf Röttger mail at ulfroettger.de
Thu Jan 31 17:23:43 GMT 2008


Hello Phil, hello Mailinglist,
I have gentoo-linux (quite up to date) with PyQt 4.3.3 and Qt 4.3.3 and all 
with Python 2.4 (that's an Gentoo issue) x86_32 platform.

Gentoo compiles QtSQL-Drivers as plugins only, so I have on the Qt side sqlite 
and postgresql:
nergal at kutha /usr/lib/qt4/plugins/sqldrivers $ ls
libqsqlite.so  libqsqlite2.so  libqsqlpsql.so

This is the last idea I have got:
that they need to be compiled as:
-qt-sql-sqlite instead of -plugin-sql-sqlite
but it would mean to manipulate a lot of ebuild-stuff from Gentoo to get this 
to work, which I do hesitate to do, 'cos other software I need rely upon a 
working qt-environment.

PyQt compiles with QtSQL:
nergal at kutha /usr/lib/python2.4/site-packages/PyQt4 $ ls
Qsci.so         QtDesigner.so  QtScript.so  QtXml.so      elementtree     uic
Qt.so           QtGui.so    >>>   QtSql.so  <<<   __init__.py   pyqtconfig.py
QtAssistant.so  QtNetwork.so   QtSvg.so     __init__.pyc  pyqtconfig.pyc
QtCore.so       QtOpenGL.so    QtTest.so    __init__.pyo  pyqtconfig.pyo

I can access databases directly from Python or with non-python Qt 
applications, so I assume there is no malfunction to be expected.

Even the example from PyQt4 does not work:

nergal at kutha ~/Python/PyQt4/examples/sql $ python
Python 2.4.4 (#1, Oct 26 2007, 16:35:26)
[GCC 4.1.2 (Gentoo 4.1.2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from connection import createConnection
>>> createConnection()
QSqlDatabase: QSQLITE driver not loaded
QSqlDatabase: available drivers:
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "connection.py", line 33, in createConnection
    QtGui.QMessageBox.critical(None, QtGui.qApp.tr("Cannot open database"),
RuntimeError: underlying C/C++ object has been deleted
>>>

I am at the end of my rather modest wits ;) - I do not see what's going wrong.
Any hint would be great.
!THANKS!
Cheers, 
Ulf


More information about the PyQt mailing list