[Qgis-user] plugin helloworld 1.5

Borys Jurgiel lists at borysjurgiel.pl
Mon Jul 29 02:41:34 PDT 2013


Dnia poniedziaƂek, 29 lipca 2013 o 07:14:05 Su Hartono napisaƂ(a):
> I use OS Ubuntu 12.04.
> I got "Error loading plugin"
> The plugin is broken.  Python said:
> 'module' object has no attribute 'classFactory'.
> How to fix it ?
> -- thank you--
> Suhartono

There is a bug in the plugin so the __init__.py file is empty. Just add 
following simple function to it (mind the indentation): 

def classFactory(iface):
  from HelloWorld import HelloWorld
  return HelloWorld(iface)

You can also use that file from the 1.0 version. For more information look at 
the PyQGIS cookbook [1]. 

Btw. note for QGIS 1.8 you need to put plugin metadata to both: __init__.py 
and metadata.txt files. From QGIS 2.0 the only place to put the metadata is the 
metadata.txt file. The __init__.py should only contain the classFactory 
function.

[1] http://www.qgis.org/pyqgis-cookbook/plugins.html#plugins



More information about the Qgis-user mailing list