Closed jakubclark closed 2 years ago
I have not run this but my guess is to remove PluginA to depend on PluginC.
You should be able to load up pluginC from pluginA, as self.get_plugin('PluginC')
.
Thanks @sijis. Removing the PluginC
depedency from PluginA
seems to work, I'll try this against my actual chatbot tomorrow. If all goes well, I'll close this issue.
By making PluginA
not explicitly depend on PluginC
the "circular dependencies" have been resolved, as PluginB
already depends on PluginC
.
Hi, I have the exact same sort of setup as @jakubclark and the suggested mitigations don't work for me. Agree with @jakubclark that this shouldn't be a circular dependency issue.
I've also run into another issue while trying to set up a simple PluginA
-> PluginB
-> PluginC
relationship: for some reason, despite PluginB
's Core section listing PluginC
as a dependency, self.dependencies
for PluginB
doesn't list PluginC
as a dependency.. so when I try self.get_plugin('PluginC')
in PluginB
I get an exception about how
Plugin dependency PluginC needs to be listed in section [Core] key "DependsOn" to be used in get_plugin.
It doesn't sound like this issue is closed. The circular dependency logic seems faulty and there's some sort of bug that results in self.dependencies
not being populated properly.
EDIT: Added self.dependencies.append('PluginC')
in PluginB
before self.get_plugin('PluginC')
, everything works fine. Seems like a bug?
Reopening this, as the issue has occurred once again:
PluginA
depends on PluginB
PluginB
depends on PluginC
class PluginA(BotPlugin)
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.plugin_c = self.get_plugin('PluginC')
Error message: "Plugin dependency PluginC needs to be listed in section [Core] key "DependsOn" to be used in get_plugin."
I had to restart my bot 3 times, before self.get_plugin('PluginC')
did not fail.
It seems that it is random, if self.get_plugin('PluginC')
results in an error. If it does result in an error, the bot must be restarted a few times, and eventually it will work.
Could you validate if this behavior happens using the master branch?
I can confirm this happens with Errbot version 6.1.4. Inconsistently giving me the same error.
I am...
I am running...
Issue description
I have a situation where I have a total of 3 plugins:
Below are their plugin dependencies:
I've roughly visualized the dependencies here:
Trying to run with this configuration results in an error:
PluginA fails to load, due to "circular dependencies". However, I do not see circular dependencies from what I described above.
So is this intentional; not allowing PluginA to depend on PluginC, since PluginB already depends on PluginC, and PluginA does depend on PluginB?
There aren't circular dependencies, since
self
depends on the same plugins as a child plugin depends on.A workaround is to do something like this:
PluginA does not depend on PluginC
Then, from within
PluginA
do teh following:Steps to reproduce
I've created a repo with the necessary code to reproduce this error here. Simply run the test:
pytest plugins_test.py
. Or runerrbot
itself, it is configured for text mode.