[PyKDE] Unchecked plugin directory access

Lorenzo Mancini lmancini at develer.com
Thu Dec 21 13:49:49 GMT 2006


Hello,

in PyQt 4.1.1 and snapshot 20061220, class QObjectCreator makes an
unchecked access to widget-plugins directory in its constructor:

(PyQt4/uic/objcreator.py: 21)

plugindir = os.path.join(os.path.split(__file__)[0],
                         "widget-plugins")

for filename in os.listdir(plugindir):
    (...)


The above code gets executed if you build your UIs with Designer and
then use loadUi in your application. There is nothing wrong with that,
as long as you run your programs through the Python interpreter.

However, should one try to package the appplication with PyInstaller,
py2exe and similar tools, that would be an issue, since likely that
directory won't be available in "frozen" state.

Moreover, if I understood correctly that directory is only useful if you
have certain widgets in your application.

So, is it reasonable to have a runtime check for that directory's
existance (with os.path.exists, before the for loop)?

Thanks in advance!

-- 
Lorenzo Mancini




More information about the PyQt mailing list