From 773c564174f8147015d71bd8dd52f73c10701d3a Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 20 May 2011 08:58:28 -0600 Subject: [PATCH] Fix loading plugins in worker process --- src/calibre/utils/ipc/worker.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/calibre/utils/ipc/worker.py b/src/calibre/utils/ipc/worker.py index 88e571673f..fa512c56ba 100644 --- a/src/calibre/utils/ipc/worker.py +++ b/src/calibre/utils/ipc/worker.py @@ -110,6 +110,10 @@ def arbitrary(module_name, func_name, args, kwargs={}): function ``func_name`` :param kwargs: A dictionary of keyword arguments to pass to func_name ''' + if module_name.startswith('calibre_plugins'): + # Initialize the plugin loader by doing this dummy import + from calibre.customize.ui import find_plugin + find_plugin module = importlib.import_module(module_name) func = getattr(module, func_name) return func(*args, **kwargs) @@ -124,6 +128,10 @@ def arbitrary_n(module_name, func_name, args, kwargs={}, completed and the second is a string with a message (it can be an empty string). ''' + if module_name.startswith('calibre_plugins'): + # Initialize the plugin loader by doing this dummy import + from calibre.customize.ui import find_plugin + find_plugin module = importlib.import_module(module_name) func = getattr(module, func_name) kwargs['notification'] = notification