Lisen
Lisen

Reputation: 198

no module named res_rc after compile res.qrc file using pyrrc5.exe

With Qt Creator I created a .ui file and set the main window icon referred to a .ico in res.qrc file.
Then in PyCharm I used pyuic&pyrcc to convert qt files to .py files.
However after I start up my app, I got an import error saying that No module named res_rc in converted ui.py.
I don't know why this time I got the import error. Before today I could really use res_rc.py in my severval pyqt5 examples .
Did I miss something that vital ?

Upvotes: 0

Views: 743

Answers (2)

papadulo
papadulo

Reputation: 13

ui is looking for your res_rc.py in the root folder and you may have saved it somewhere else. There are 2 solutions: move the file to the root of the program or in the ui.py file change the import to "yourmodule.res_rc.py'

Upvotes: 0

Lisen
Lisen

Reputation: 198

It seems that files like res_rc.py and ui.py should be in the same folder with app.py and now it works fine.
Previously I put res_rc.py and ui.py in a sub folder

Upvotes: 1

Related Questions