Skip to content

Commit 2e545a3

Browse files
committed
change way Plugin is imported
1 parent e02cb4a commit 2e545a3

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

nipype/pipeline/engine/workflows.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757

5858
from .base import EngineBase
5959
from .nodes import Node, MapNode
60+
from .. import plugins
6061

6162
package_check('networkx', '1.3')
6263
logger = logging.getLogger('workflow')
@@ -557,16 +558,8 @@ def run(self, plugin=None, plugin_args=None, updatehash=False):
557558
if not isinstance(plugin, (str, bytes)):
558559
runner = plugin
559560
else:
560-
name = 'nipype.pipeline.plugins'
561-
try:
562-
__import__(name)
563-
except ImportError:
564-
msg = 'Could not import plugin module: %s' % name
565-
logger.error(msg)
566-
raise ImportError(msg)
567-
else:
568-
plugin_mod = getattr(sys.modules[name], '%sPlugin' % plugin)
569-
runner = plugin_mod(plugin_args=plugin_args)
561+
SelectedPlugin = getattr(plugins, '%sPlugin' % plugin)
562+
runner = SelectedPlugin(plugin_args=plugin_args)
570563
flatgraph = self._create_flat_graph()
571564
self.config = merge_dict(deepcopy(config._sections), self.config)
572565
if 'crashdump_dir' in self.config:

0 commit comments

Comments
 (0)