[PyQt] pyuic5 --from-imports does not work, generates absolute imports

Phil Thompson phil at riverbankcomputing.com
Sun May 8 13:42:13 BST 2016


On 8 May 2016, at 10:46 am, Dmitry Shachnev <mitya57 at ubuntu.com> wrote:
> 
> Forwarding a bug report from Debian (https://bugs.debian.org/823615),
> reported against PyQt 5.6:
> 
> ----- Begin forwarded message -----
> 
> Hi, I'm trying to rebuild the .py files in hplip from their UI files, but pyuic5
> always generates absolute imports instead of relative ones, causing the generated
> code to fail.
> 
> For example, run pyuic5 --from-imports on
> http://anonscm.debian.org/cgit/printing/hplip.git/tree/ui5/devmgr5_base.ui
> It should generate code like this:
> http://anonscm.debian.org/cgit/printing/hplip.git/tree/ui5/devmgr5_base.py
> That is:
> from .printsettingstoolbox import PrintSettingsToolbox
> 
> Our pyuic5 however generates:
> from printsettingstoolbox import PrintSettingsToolbox
> 
> Which causes hplip to fail to run.
> 
> ----- End forwarded message -----
> 
> (I have done s/.ui/.py/ on the second link because I assume this is what the
> original reporter meant.)

This is a documentation bug. --from-imports and --import-from only apply to the import of resource files. Otherwise the behaviour is the same as PyQt4.

Phil


More information about the PyQt mailing list