2

I just develop a custom plugin in QGIS. It folder located here

C:\Users(user).qgis2\python\Plugins\PluginTest

But it is not showing the plugin in QGIS, although a downloaded plugin VectorCompare showing correctly in plugin dropdown. I have no warning or error log. I just saw an error in Plugin > Installed tab.

Couldn't load plugin TaskAutomation due to an error when calling its classFactory() method

>     ImportError: No module named resources 
>     Traceback (most recent call last):
>       File "E:/QGISSE~1/apps/qgis/./python\qgis\utils.py", line 306, in startPlugin
>         plugins[packageName] = package.classFactory(iface)
>       File "C:/Users/FK/.qgis2/python/plugins\TaskAutomation\__init__.py", line 34, in
> classFactory
>         from .TLL_Task import TaskAutomation
>       File "E:/QGISSE~1/apps/qgis/./python\qgis\utils.py", line 572, in _import
>         mod = _builtin_import(name, globals, locals, fromlist, level)
>       File "C:/Users/FK/.qgis2/python/plugins\TaskAutomation\TLL_Task.py", line 26, in 
>         import resources
>       File "E:/QGISSE~1/apps/qgis/./python\qgis\utils.py", line 572, in _import
>         mod = _builtin_import(name, globals, locals, fromlist, level)
>     ImportError: No module named resources
  • Try running this: pyrcc4 -o resources.py resources.qrc – Joseph Oct 6 '16 at 10:02
2

I run this command in my qgis plugin through OSGeo4W to resolve this error

pyrcc4 -o resources.py resources.qrc

Complete command run on OSGeo4W Shell

C:\Users\[your user name]\.qgis2\python\Plugins\PluginTest pyrcc4 -o resources.py resources.qrc

QGIS Doucmentation provided the details

| improve this answer | |
  • I was running in the system command prompt; I had to go to the OSGeo4W shell to resolve this issue. – D_C Jan 8 '18 at 16:40
1

Depending on the plugin category it might be available from another drop down menu, e.g. 'Web' or 'Vector'.

Have you also checked the 'Manage and Install plugins' dialog? If this does not help you, please provide more information. Did you build it using the Plugin Builder plugin?

| improve this answer | |
  • question updated – Muhammad Faizan Khan Oct 4 '16 at 11:41
  • Maybe rebuild resources using the OSGeo4W Shell? Seems related to this – Hydrographer Oct 4 '16 at 11:50
  • make command is not working – Muhammad Faizan Khan Oct 4 '16 at 11:56
  • Try 'make clear' and then 'make deploy'. Do you have the resources.py file? Maybe it needs fixing... – Hydrographer Oct 4 '16 at 11:59
  • where to check resource file – Muhammad Faizan Khan Oct 4 '16 at 12:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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