Yapsy throws TypeError on init, missing arguments in init

I have been working with Yapsy (version 1.10.423) lately and I am facing a problem with (I think) a package which is the latest from PyPi.

The footprint I get is below.

Traceback (most recent call last):
  File "./clayrd.py", line 256, in <module>
    run()
  File "./clayrd.py", line 202, in run
    loadPlugins()
  File "./clayrd.py", line 121, in loadPlugins
    _pluginMgr.collectPlugins()
  File "/usr/local/lib/python2.7/dist-packages/yapsy/PluginManager.py", line 531, in collectPlugins
    self.loadPlugins()
  File "/usr/local/lib/python2.7/dist-packages/yapsy/PluginManager.py", line 513, in loadPlugins
    plugin_info.plugin_object = element()
TypeError: __init__() takes exactly 3 arguments (1 given)

      

The method in question starting with the trace below is

def loadPlugins():
    """
    Load up all of our plugins
    """

    # Set plugin dir and horde them
    _pluginMgr  =   PluginManager() # Defined at start of script
    _pDir       =   os.path.join(_config['run_dir'], _pluginDir)
    _logger.info("Worker is loading plugins from {}".format(_pDir))
    _pluginMgr.setPluginPlaces([_pDir])
    _pluginMgr.collectPlugins() # This is line 121

    # Attempt plugin activation
    for plugin in _pluginMgr.getAllPlugins():
        _logger.info("Worker attempting to activate plugin {}".format(plugin.name))

        _loaded =   _pluginMgr.activatePluginByName(plugin.name)
        if _loaded == False:
            _logger.warn("Failed to load plugin {}".format(plugin.name))
            continue

        else:
            _logger.info("Plugin {} loaded successfully. Loading dependencies...".format(plugin.name))

      

My question is simple: is this really a bug with Yapsy, or am I missing something else?

+3


source to share


1 answer


element

which is "called" at the bottom of the stack is actually the plugin class that yapsy is trying to initialize. So it element()

actually calls the plugin class method __init__

.

Going back to the exception message, this seems to indicate that your plugin class has a constructor that requires more arguments than just self

, but yapsy expects the plugin class to not require an explicit argument at build time.

As a consequence, you should check the plugin class definition of the plugin being loaded, because that is very likely where the problem is.



If the 'init class only has one arg argument self

, you can look at the troubleshooting documentation for yapsy that describes possibly related to it.

If that doesn't work, you can post a small sample code of the plugin file that is causing the problem.

+3


source







All Articles