Skip to content

Commit c6aca88

Browse files
committed
Merge pull request #987 from satra/fix/ipython
fix: ensure ipython engine is not left in an undefined directory - close...
2 parents cc73dd5 + c85c6c4 commit c6aca88

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

nipype/pipeline/plugins/ipython.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ def execute_task(pckld_task, node_config, updatehash):
2222
from nipype import config, logging
2323
traceback=None
2424
result=None
25+
import os
26+
cwd = os.getcwd()
2527
try:
2628
config.update_config(node_config)
2729
logging.update_logging(config)
@@ -31,6 +33,7 @@ def execute_task(pckld_task, node_config, updatehash):
3133
except:
3234
traceback = format_exc()
3335
result = task.result
36+
os.chdir(cwd)
3437
return result, traceback, gethostname()
3538

3639
class IPythonPlugin(DistributedPluginBase):
@@ -72,7 +75,7 @@ def run(self, graph, config, updatehash=False):
7275

7376
def _get_result(self, taskid):
7477
if taskid not in self.taskmap:
75-
raise ValueError('Task %d not in pending list'%taskid)
78+
raise ValueError('Task %d not in pending list' % taskid)
7679
if self.taskmap[taskid].ready():
7780
result, traceback, hostname = self.taskmap[taskid].get()
7881
result_out = dict(result=None, traceback=None)

0 commit comments

Comments
 (0)