After the pyqt + sqlite program is released, the system prompts "driver not loaded"

Source: Internet
Author: User
Tags key case

I wrote a small program using PyQt4 and used the sqlite database. Everything works normally in my debugging environment. When I use cx_Freeze to package it and run the corresponding exe, the error always prompts "sqlite driver not loaded". It seems that the driver corresponding to sqlite is not found. So Baidu + google found many people with such problems. The reason for this error is very simple, that is, the DLL library is missing. Cx_Freeze has copied sqlite3.dll and qtsql4.dll to the working directory, but the database driver qsqlite4.dll of QT itself does not. So I found a qsqlite4.dll file and checked it directly to the working directory to run it. An error is still reported. So after in-depth research, we found that the so-called database driver belongs to plugins in qt. These plug-ins must be placed under a specific folder in the working directory during packaging and publishing, for example, the database driver should be placed in the "sqldrivers" directory and be in lower case. See the following table:

Base Class Directory Name Key case sensiti.pdf
Qaccessiblebridgeplugin Accessiblebridge Case Sensitive
Qaccessibleplugin Accessible Case Sensitive
Qdecorationplugin Decorations Case Sensitive
Qiconengineplugin Iconengines Case Insensitive
Qimageioplugin Imageformats Case Sensitive
Qinputcontextplugin Inputmethods Case Sensitive
Qkbddriverplugin Kbddrivers Case Sensitive
Qmousedriverplugin Mousedrivers Case Sensitive
Qpictureformatplugin Pictureformats Case Sensitive
Qscreendriverplugin Gfxdrivers Case Sensitive
Qscriptextensionplugin Script Case Sensitive
Qsqldriverplugin Sqldrivers Case Sensitive
Qstyleplugin Styles Case Insensitive
Qtextcodecplugin Codecs Case Sensitive

 

 

Main reference: http://www.cuteqt.com/blog? P = 1002 with plug-ins

Http://www.cuteqt.com/blog? P = 1059 continue with the plug-in

Http://doc.qt.nokia.com/4.3/plugins-howto.html how to create QT plugins

Http://doc.qt.nokia.com/4.3/qt-conf.html using QT. conf.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.