6

I'm trying to create a resource file for the GUI i'm creating with PyQt 5.

I've used the command line

pyrcc5 -o image_rc.py D:\MyFolder\resource_file.qrc

but i get an error message : No resources in resource description

This is how my resource file looks :

<!DOCTYPE RCC>
<RCC>
    <qresource prefix="/images">
        <file alias="img">Images\mypic.png</file>
    </qresource>

</RCC>

I've followed this topic : python 3 how to put pics inside my program but i somehow have something wrong.

QUESTION : if i understand, when you have a resource file, you still need to have the images in a folder somewhere. So why bother making a resource file then ? Isn't the same ? The images can still be deleted or moved no ?

Community
  • 1
  • 1
guy16
  • 233
  • 2
  • 3
  • 16

5 Answers5

4

For anyone facing this issue in the future, here is how I solved it.

find the following batch file : pyuic5.bat

Which is a batch file, Edit it to add your own .ui file:

@"C:\Users\******\AppData\Local\Programs\Python\Python35-32\python" -m PyQt5.uic.pyuic %1 %2 %3 %4 %5 %6 %7 %8 %9 Design.ui -o Design.py

pause

Hit enter in the CMD, then the "Design.py" will be created in the folder.

Good Luck.

Saeed I
  • 35
  • 4
0

I also met this problem. In your case you should change your command to:

pyrcc5 D:\MyFolder\resource_file.qrc -o D:\MyFolder\resource_file.qrc_rc.py

Hope this can help you.

Jonasquid
  • 11
  • 2
0

Ran into something similar with the new pyside2-rcc implementation. In my case the .qrc file I was using had the normal XML declaration line at the top ('<?xml version="1.0" ?>').

Once I removed the XML declaration it started working perfectly. So my qrc file now has '<RCC version="1.0">' as the very first line.

Maybe your "<!DOCTYPE RCC>" line is/was causing something similar?

Figured I'd throw this out there in case anyone else runs into it.

0

I think you want to add an image to your interface by using stylesheet in Qwidget, anyway you can avoid this problem for add an image by using pixmap ->choose file

Banana
  • 13
  • 3
0

I tried many methods, but it didn't work. Finally, I put the file in the project directory and it compiled successfully

Daneel R.
  • 527
  • 3
  • 9