[Eric] Unable to activate eric4 assistant plugin: The SQLite database driver is not available.

detlev detlev at die-offenbachs.de
Fri Feb 12 17:01:24 GMT 2010


Hi,

to me it seems to be a PyQt4 problem. On all the systems I have used so far, 
the code works without adding a library path (various Linux, Win XP, Win 7).

Detlev

On Freitag, 12. Februar 2010, Matthew Sorenson wrote:
> I am having trouble activating the eric4 assistant plugin. The error is:
> "The SQLite database driver is not available." I am using PyQt 4.7 on
> Python 2.6.4 and eric 4.4.1. The database drivers are all plugins.
> 
> I believe I have narrowed the problem down to the differences between
> the examples at the end. Checking into the databases before
> instantiating a QApplication seems to change the library paths.
> 
> The PluginAssistantEric.py script has the following check:
>          drivers = QSqlDatabase.drivers()
>          if drivers.contains("QSQLITE"):
>              return True
>          else:
>              error = self.trUtf8("The SQLite database driver is not
> available.")
>              return False
> 
> At this point, there are no drivers loaded. I recreated the situation in
> the shell and
> "QtGui.QApplication.addLibraryPath("C:\Python26\Lib\site-packages\PyQt4\plu
> gins")" will load the drivers. So while I have a temporary fix by adding
>  this line into the script, I would like to know how I could solve this in
>  a more permanent fashion. My apologies if this is a problem with PyQt
>  instead of eric, but I do not know what the correct behavior should be.
> 
> Thanks,
> Matthew Sorenson
> 
> Examples:
> ---------------------------------------------------------------------------
> --------------------------------- Python 2.6.4 (r264:75708, Oct 26 2009,
>  08:23:19) [MSC v.1500 32 bit (Intel)] on hermes, Standard
> 
>  >>> import sys
>  >>> from PyQt4 import QtGui, QtSql
>  >>> app = QtGui.QApplication(sys.argv)
>  >>> QtSql.QSqlDatabase.drivers().count()
> 
> 7
> 
>  >>> db = QtSql.QSqlDatabase.addDatabase("QSQLITE")
>  >>> QtGui.QApplication.libraryPaths().count()
> 
> 2
> 
>  >>> print QtGui.QApplication.libraryPaths()[0]
> 
> C:/Python26/Lib/site-packages/PyQt4/plugins
> 
>  >>> print QtGui.QApplication.libraryPaths()[1]
> 
> C:/python26
> 
> ---------------------------------------------------------------------------
> ---------------------------------- Python 2.6.4 (r264:75708, Oct 26 2009,
>  08:23:19) [MSC v.1500 32 bit (Intel)] on hermes, Standard
> 
>  >>> import sys
>  >>> from PyQt4 import QtGui, QtSql
>  >>> QtSql.QSqlDatabase.drivers().count()
> 
> 0
> 
>  >>> app = QtGui.QApplication(sys.argv)
>  >>> QtSql.QSqlDatabase.drivers().count()
> 
> 0
> 
>  >>> db = QtSql.QSqlDatabase.addDatabase("QSQLITE")
>  >>> StdErr: QSqlDatabase: QSQLITE driver not loaded
> 
> QSqlDatabase: available drivers:
>  >>> QtGui.QApplication.libraryPaths().count()
> 
> 1
> 
>  >>> print QtGui.QApplication.libraryPaths()[0]
> 
> C:/python26
> 
> QtGui.QApplication.addLibraryPath("C:\Python26\Lib\site-packages\PyQt4\plug
> ins")
> 
>  >>> QtGui.QApplication.libraryPaths().count()
> 
> 2
> 
>  >>> QtSql.QSqlDatabase.drivers().count()
> 
> 7
> 
>  >>> db = QtSql.QSqlDatabase.addDatabase("QSQLITE")
>  >>> StdErr: QSqlDatabasePrivate::removeDatabase: connection
> 
> 'qt_sql_default_connection' is still in use, all queries will cease to
>  work. QSqlDatabasePrivate::addDatabase: duplicate connection name
> 'qt_sql_default_connection', old connection removed.
> 
> _______________________________________________
> Eric mailing list
> Eric at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/eric
> 


-- 
Detlev Offenbach
detlev at die-offenbachs.de


More information about the Eric mailing list