2

I am having the same issue described in this post on the py2app mailing list.

I have a python application that uses a sqlite database. On my machine, which has all the dependencies installed, there are no issues. However, when I bundle the application with py2app, clicking a menu that causes the database to be accessed results in this error:

Database error: Driver not loaded Driver not loaded

For the Windows installer, the files in \Qt\version\plugins\sqldrivers\*.* can be copied to \myApp\sqldrivers\*

The same files on the Mac can be found in /opt/local/share/qt4/plugins/sqldrivers (installed via Macports).

However, copying the sqldrivers directory to my application's Resources or Frameworks directories still results in the same error.

How can I add sqlite support into my application that is built using py2app?

Patrick Kenny
  • 4,515
  • 7
  • 47
  • 76

3 Answers3

1

have you tried what he said in this post ? py2app setup.py usage question it mentioned

you need to include the sqlalchemy.dialects.sqlite as a package

Community
  • 1
  • 1
lucemia
  • 6,349
  • 5
  • 42
  • 75
1

I managed to get this to work as follows:

After building with py2app, inside the application's Contents directory, make a new plugins directory.

Then copy sqldrivers/libqsqlite.dylib into this plugins directory.

Afterwards, install_name_tool has to be used to change the library links in libqsqlite.dylib to point to the Qt libraries in the application's Frameworks directory rather than the system Qt libraries.

Patrick Kenny
  • 4,515
  • 7
  • 47
  • 76
1

Turns out the pyside recipe does have a way to specify which qt-plugins you need...

    options=dict(py2app={
                         'argv_emulation': True,
                         'qt_plugins' : "sqldrivers",
                         }
                 ),

This puts all the sqldrivers into the right directory and setups qt.conf correctly.

fxsam
  • 46
  • 2