|
From: Jimmy R. <ji...@re...> - 2007-10-17 07:55:19
|
On 10/14/07 10:31 AM, "IloChab" <il...@gm...> wrote:
> I wrote an application that uses PyQt4 to access a sqlite DB.
>
> Now I'm trying to convert it using py2exe and I found some problems.
>
> The last one, that I'm not able to avoid, is that when I launch the
> application's binary on a PC (that contains only a Python 2.5
> installation and no QT4) I get an error trying to open the DB with
> this code:
>
> db = QtSql.QSqlDatabase.addDatabase("QSQLITE")
> db.setDatabaseName (defines.DB_FILE)
> if not db.open():
> # displays:
> Driver not loaded.
>
> I made many attempts changing options in my setup file but none of
> them successfull.
> The last one uses this options:
>
> options={"py2exe": {"includes":["sip", 'PyQt4.QtSql' ],
> "packages": ["sqlite3",]}}
>
> but I verified that neither QtSql, neither sqlite3 are usefull to
> avoid the error.
>
> My development configuration is
> Python 2.5
> Qt4 4.2.2
> PyQt 4.1.1
>
> Any suggestion to solve this problem?
I haven't used PyQt with py2exe. From your description and the code above,
it sounds like QT is dynamically loading database "drivers" - this language
implies to me that they are loaded dynamically which would mean that py2exe
can't detect that they're needed. If you poke around in the PyQt and/or Qt
directories maybe you'll spot a dll that mentions sqlite. Try throwing that
into the directory with your exe and see if that helps you get further. If
so, then you could use the data-files option to include it manually.
Jimmy
|