[PyKDE] plugins and py2exe in PyQt4
Giovanni Bajo
rasky at develer.com
Sun Feb 25 18:03:50 GMT 2007
On 25/02/2007 17.21, Phil Thompson wrote:
>> Following on from previous threads, e.g.
>> http://www.mail-archive.com/pykde@mats.imk.fraunhofer.de/msg09585.html and
>> http://www.mail-archive.com/pykde@mats.imk.fraunhofer.de/msg09565.html ,
>> the widget-plugins directory does not exist if a script is converted to an
>> exe file using py2exe (well it exists in a zip file, but that's hard to
>> solve). This means you can't load ui files in the program.
>>
>> An easy workaround would be for objcreator.py to ignore loading plugins if
>> the plugin directory does not exist. Would it be possible to have a check
>> for the directory or a catch for the exception?
>
> I would prefer to see the real bug in py2exe fixed.
I maintain PyInstaller. Personally, I can't do anything to fix this, if
objcreator.py insists on unconditionally calling os.listdir(). I suggest two
solutions:
1) Modify objcreator.py to use the not-standard-but-almost-and-widely-used
pkg_resources API. PyInstaller does not support this yet, but pkg_resources is
already very extensible, and PyInstaller (at runtime) could register a hook
to let it find resource files in any way they're packaged (eg. PyInstaller
even supports encryption...).
2) The same as above, but rolling up your own API instead of relying on
pkg_resources.
#1 looks like the best option of course, since I don't like having to reinvent
the wheel. It also means that PyInstaller, py2exe and others just have to
support pkg_resources.
--
Giovanni Bajo
More information about the PyQt
mailing list