3

I have resources.qrc compiled to resources.py using the following batch file:

@echo off
call "C:\Program Files\QGIS 3.0\bin\o4w_env.bat"
call "C:\Program Files\QGIS 3.0\bin\qt5_env.bat"
call "C:\Program Files\QGIS 3.0\bin\py3_env.bat"

@echo on
pyrcc5 -o resources.py resources.qrc

I import resources at the beginning of the code but i get the following error:

ModuleNotFoundError: No module named 'resources'

I tried editing the .ui file as explained here: QGIS plugin: Problems importing resources (resources_rc) file - plugin doesn't load - PATH problems? But I don't have the exact same lines as mentioned instead of:

<resources>
  <include location="resources.qrc"/>
</resources>

I have:

<resources/>
 <connections/>
</ui>

Here is the content of the folder: enter image description here Does somebody have a clue what is wrong?

8
  • Post the full code of the .bat file, and a screenshot of the contents of the folder.
    – HeikkiVesanto
    Commented Mar 13, 2018 at 11:29
  • @HeikkiVesanto Thank you, added a screenshot, the bat file is in it's full version however
    – Carmel Han
    Commented Mar 13, 2018 at 12:22
  • Try with from resources import * Commented Mar 13, 2018 at 12:50
  • I'm not answering your question. I personally stopped using resources files in all my plugins. I saw the same in other plugins. Using the filepath on the file system is working well to load icons, images or whatever. We don't have to recompile anymore this file.
    – etrimaille
    Commented Mar 13, 2018 at 13:22
  • Can you try the bat script from: gis.stackexchange.com/questions/260743/… That works for me.
    – HeikkiVesanto
    Commented Mar 13, 2018 at 13:37

1 Answer 1

3

As your ParcelCapture.py and resources.py are in same directory you can use relative path like this from .resources import * to import resources module into your ParcelCapture.py.
Hope this answers your question.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.