[PyQt] py3qt5 system path

Baz Walter bazwal at ftml.net
Wed Jun 28 14:18:39 BST 2017


On 28/06/17 08:47, Ritesh Raj Sarraf wrote:
> On Wed, 2017-06-28 at 08:21 +0200, Vincent Vande Vyvre wrote:
>> Then, you have to write: from apt_offline_gui import resources.rc
> 
> I think you put a typo there. It should be resources_rc.
> 
> I tried it but that did not work. I think the problem lies with pyuic4, which
> generates the .py files from the .ui files. Because my exception lies in there.
> 
> rrs at learner:~/rrs-home/devel/apt-offline/apt-offline (master)$ ./apt-offline-
> gui
> Traceback (most recent call last):
>    File "./apt-offline-gui", line 29, in <module>
>      from apt_offline_gui import AptOfflineQtMain
>    File "/media/SSHD/rrs-home/devel/apt-offline/apt-
> offline/apt_offline_gui/AptOfflineQtMain.py", line 4, in <module>
>      from apt_offline_gui.Ui_AptOfflineQtMain import Ui_AptOfflineMain
>    File "/media/SSHD/rrs-home/devel/apt-offline/apt-
> offline/apt_offline_gui/Ui_AptOfflineQtMain.py", line 155, in <module>
>      import resources_rc
> ImportError: No module named 'resources_rc'
> 2017-06-28 / 13:29:55 ♒♒♒  ☹  => 1
> 
> The bug I see is, that the user is not supposed to hand-update the generated files.
> That's why I asked here is this is a bug.
> 

Compile the gui modules like this:

     pyuic4 --from-imports -o $OUTDIR/output.py input.ui

This will add the correct import statement to the end of the generated 
gui module. You should then compile the resources module like this:

     pyrcc4 -o $OUTDIR/resources_rc.py resources.qrc

For this to work, the resources module **MUST** be written to the same 
directory as the gui modules. Also, the resources file **MUST** be named 
"resources_rc.py" (although, if you really need to, you can modify it 
slightly using the pyuic4 --resource-suffix option).


More information about the PyQt mailing list