pericazivkovic / portablepython

Build environment for the Portable Python project
http://www.PortablePython.com
106 stars 53 forks source link

PyQt plugins not loaded #1

Closed pericazivkovic closed 11 years ago

pericazivkovic commented 11 years ago

I found a problem with Portable Python and PyQt. My application refused to load a jpeg picture file in a QPixmap or in a QImage. I.e. pixmap = QPixmap('file.jpg') just refused to work. This was strange because in other contexts (non-portable Python install) it worked.

After a while, I found that the same problem has been described with python compilers such as py2exe or freeze. The problem is that at runtime Python cannot find the folder where the dlls for decoding image formats are. In PP, these dlls are in PP\App\Lib\site-packages\PyQt4\plugins.

In a non-portable installation the install path of PyQt4 can be found in the register, but this is not the case with P.P. There is a number of solutions proposed for this problem, some of which go against portability. I resolved the problem creating a qt.conf file in /PP/App. The file is like this:

[Paths] Prefix = . Binaries = . Plugins = /PP/App/Lib/site-packages/PyQt4/plugins

This file actually exists somewhere in the PyQt folders, but it lacks the crucial Plugins entry. Also, I think that it works only in the App folder. Not specifying the unit makes the configuration file slightly more portable but in certain circumstances it could fail. I wonder if there is a more generic solution to this problem.

Tom Sobota Software developer Madrid, Spain

pericazivkovic commented 11 years ago

Added patch qt.conf to /App folder