Sunday 29 January 2017

qgis - Can't execute plugin made by Plugin Builder


I have read this post: Can't compile plugin builder plugin in QGIS 2.4 (Windows)


But I couldn't resolve my problem.


I have already seen this post, looking for help. I can execute:



pyrcc4 -o resources_rc.py resources.qrc

But when I want to open my plugin made by Plugin Builder, it displays an error, saying that it is "broken".


enter image description here



Answer



It seems your plugin doesn't have a metadata.txt file, could you have a look at the plugin folder to check if such file is present?


Make sure all your plugin files are inside your plugin folder, which in turn should be inside python/plugins/ folder, like this:


qgis2/
...python/
......plugins/

.........NPlugin/
............metadata.txt
............__init_.py
............icon.png
............(and all other files)

Sometimes, one can make a mistake and create an extra folder while choosing the directory to save the plugin, like this:


qgis2/
...python/
......plugins/

.........NPlugin/
............NPlugin/
...............metadata.txt
...............__init_.py
...............icon.png
...............(and all other files)

Note the double NPlugin folder (python/plugins/NPlugin/Nplugin/...), which will make QGIS not to load the plugin. If that's your case, just leave a single NPlugin folder, from which QGIS can access all plugin files (such as in the first directory structure I mentioned).


If, on the contrary, your directory structure is fine, your plugin is missing a metadata file. Create a new file metadata.txt inside you plugin folder, containing information like:


# This file contains metadata for your plugin.         

[general]
name=My Plugin
qgisMinimumVersion=2.0
description=My plugin does a lot of things
version=0.1
author=Me
email=me@mycompany.co

about=Plugin to do a lot of things


tracker=http://www.mycompany.co/tracker
repository=http://www.mycompany.co/git

# Tags are comma separated with spaces allowed
tags=GIS,Raster

homepage=http://www.mycompany.co/
category=Plugins
icon=icon.png
# experimental flag

experimental=True

# deprecated flag (applies to the whole plugin, not just a single version)
deprecated=False

Restart QGIS (or reload your plugin) and you should now get your plugin loaded.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...