Skip to content

Commit

Permalink
plugins: fix loading of external plugins on Python < 3.10
Browse files Browse the repository at this point in the history
Pythons `ziploader` only got the `exec_module` method in Python 3.10 so
we need to use `load_module` on lower Python versions instead.
  • Loading branch information
EchterAgo committed Oct 5, 2023
1 parent 6670d6e commit c2e59b0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion electroncash/plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,10 @@ def load_external_plugin(self, name):
raise RuntimeError("%s implementation for %s plugin not found"
% (self.gui_name, name))
module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module)
if sys.version_info >= (3, 10):
spec.loader.exec_module(module)
else:
module = spec.loader.load_module(full_name)
plugin = module.Plugin(self, self.config, name)
plugin.set_enabled_prefix(EXTERNAL_USE_PREFIX)
self.add_jobs(plugin.thread_jobs())
Expand Down

0 comments on commit c2e59b0

Please sign in to comment.