[PyQt] py3qt5 system path

Scott Kitterman debian at kitterman.com
Mon Jun 26 18:07:10 BST 2017


On Monday, June 26, 2017 10:30:25 PM Ritesh Raj Sarraf wrote:
> Hello,
> 
> I recently ported my application from Python2 to Python3 and from PyQT4 to
> Py3QT5.
> 
> For the resources (icons mostly) I keep getting the following error:
> 
> rrs at learner:/var/tmp/Debian-Build/Result$ apt-offline-gui 
> Traceback (most recent call last):
>   File "/usr/bin/apt-offline-gui", line 30, in <module>
>     from apt_offline_gui.AptOfflineQtMain import AptOfflineQtMain
>   File "/usr/lib/python3/dist-packages/apt_offline_gui/AptOfflineQtMain.py",
> line 4, in <module>
>     from apt_offline_gui.Ui_AptOfflineQtMain import Ui_AptOfflineMain
>   File
> "/usr/lib/python3/dist-packages/apt_offline_gui/Ui_AptOfflineQtMain.py",
> line 155, in <module>
>     import resources_rc
> ImportError: No module named 'resources_rc'
> 2017-06-26 / 22:19:42 ♒♒♒  ☹  => 1  
> 
> 
> I am not sure why the resources module is no more resolvable from standard
> path. The same module worked fine in Py2QT4. If I append the path to the
> system path, things work. But then, they'd get overwritten on every pyuic3
> run.
> 
> Is this a known issue ? Is there any advise on how to fix this issue ?

Imports are slightly different in Python 3 (nothing PyQt specific here).  If 
you add:

from . import resources_rc

to apt_offline_gui/__init__.py it should work.

Scott K


More information about the PyQt mailing list