[Pythonmac-SIG] Sqlite database drivers with py2app?

Michael McCracken michael.mccracken at gmail.com
Fri Jun 29 05:16:18 CEST 2012


Hey, I'm glad that was useful!

Another thing that probably won't affect you, but in case it does -
make sure you keep a reference in your python script to the
QtApplication that you create.
ie, do 'app = QApplication(sys.argv)' instead of just 'QApplication(sys.argv)'.

Otherwise the QApplication will get garbage collected and weird things
happen, including forgetting where to look for plugins!

Feel free to ask about PyQt4 here, as I'm working on porting a PyQt
application to OS X now, and may have run into other problems already.

Cheers,
-mike

On Thu, Jun 28, 2012 at 7:37 PM, Patrick Kenny <ptmkenny at gmail.com> wrote:
> Thanks, that solved my problem!
>
> I really appreciate your help!
>
>
> Cheers,
> Patrick
>
> On 2012年6月29日Friday at 1:57, Michael McCracken wrote:
>
> Patrick, I've run into a similar problem - qt needs a qt.conf file to
> be created in the Contents/Resources folder of the app bundle, with a
> directive telling it where to find plugins. otherwise it looks in the
> default system path.
>
> The environment variable QT_DEBUG_PLUGINS=1 can be very useful here.
>
> -mike
>
> On Thu, Jun 28, 2012 at 11:16 AM, Patrick Kenny <ptmkenny at gmail.com> wrote:
>
> 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?
>
> Any help would be much appreciated.
>
>
> Regards,
> Patrick
>
> _______________________________________________
> Pythonmac-SIG maillist  -  Pythonmac-SIG at python.org
> http://mail.python.org/mailman/listinfo/pythonmac-sig
> unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
>
>


More information about the Pythonmac-SIG mailing list