2

I am building the plug-in for QGIS by following this tutorial.

When I am loading the plug-in, I am receiving the error The plug-in is broken, no module named resources.

Couldn't load plugin SavingAttributes due to an

error when calling its classFactory() method.

enter image description here

closed as off-topic by underdark Feb 19 '18 at 20:23

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions seeking help to debug/write/improve code must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Providing a clear problem statement and evidence of a code attempt will help others to help you. See: How to create a Minimal, Complete, and Verifiable example." – underdark
If this question can be reworded to fit the rules in the help center, please edit the question.

2

If you modify the interface with the QtDesigner and have resources in it and when you save the file at least one line is added. You must delete it, the resources are already addressed in other modules of the plugin.

At the end of the *.ui file you have:

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

and you need:

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

I hope it helps

  • I have not edit anything in the Qt yet. Just create a plugin with plugin builder and running the following command: pyrcc4 -o resources_rc.py resources.qrc – Kamran Tariq Feb 19 '18 at 10:35
  • This is a very common error. Which version of qgis do you use and which version is the plugin builder? I have resources.py instead of resources_rc.py. Say your plugin is called MyPlugin, please check MyPlugin.py for this line: import resources. Try to change it to import resources_rc or recompile resources to match that name. – Andreas Müller Feb 19 '18 at 11:07
  • Thanks Andreas! It has solved and working after replacing. – Kamran Tariq Feb 20 '18 at 11:49
  • Can you help me in a more way? I am designing a plugin for filtering attributes. I am unable to perform it. – Kamran Tariq Feb 20 '18 at 12:04
  • Simply ask a new question, so others can find it and contribute. – Andreas Müller Feb 22 '18 at 9:05

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