voidynullness

(mis)adventures in software development...

    
24 January 2013

PyQt database driver loading issues on Windows after installing PySide

Share
Category Python

Had a Windows machine with a perfectly fine and functioning development setup of ActiveState Python 2.7, QT SDK, and PyQt bindings. Then decided to install PySide. What could possibly go wrong?

There’s always something…

After installing PySide, none of my PyQt SQLite database applications would work anymore (while still using the PyQt bindings). Not even the example programs. I would get a “Driver not loaded” error when trying to initialise the database. However, the PySide database examples ran fine, so looks like installing PySide messed something up in the PyQt installation. After a couple hours of poking around and Googling (there’s hours of my life I’m not getting back!), I worked out what the problem was.

After installing PySide, this is what C:\Python27\qt.conf contained:

[Paths]
Prefix = C:/Python27/Lib/site-packages/PySide
Binaries = C:/Python27/Lib/site-packages/PySide
Plugins = C:/Python27/Lib/site-packages/PySide/plugins
Translations = C:/Python27/Lib/site-packages/PySide/translations

I changed it to:

[Paths]
Prefix = C:/Python27/Lib/site-packages/PyQt4
Binaries = C:/Python27/Lib/site-packages/PyQt4
Plugins = C:/Python27/Lib/site-packages/PyQt4/plugins
Translations = C:/Python27/Lib/site-packages/PyQt4/translations

And once again, I was able to run my existing PyQt database code successfully.

Looks like I’ll have to maintain 2 copies of that qt.conf file, and switch between them depending on whether I’m running PySide or PyQt applications. Not ideal, but at least things are working once again.

In hindsight, I probably should have used the setuptools installation method, possibly inside a virtualenv.


 

Comments