@@ -249,14 +249,15 @@ def save_resultfile(result, cwd, name, rebase=True):
249249 with indirectory(cwd):
250250 # All the magic to fix #2944 resides here:
251251 for key, old in list(outputs.items()):
252- val = rebase_path_traits(result.outputs.trait(key), old, cwd)
253- if old != val: # Workaround #2968: Reset only changed values
252+ if isdefined( old):
253+ val = rebase_path_traits(result.outputs.trait(key), old, cwd)
254254 setattr(result.outputs, key, val)
255255 savepkl(resultsfile, result)
256256 finally:
257257 # Restore resolved paths from the outputs dict no matter what
258258 for key, val in list(outputs.items()):
259- setattr(result.outputs, key, val)
259+ if isdefined(val):
260+ setattr(result.outputs, key, val)
260261
261262
262263def load_resultfile(results_file, resolve=True):
@@ -306,9 +307,9 @@ def load_resultfile(results_file, resolve=True):
306307
307308 logger.debug('Resolving paths in outputs loaded from results file.')
308309 for trait_name, old in list(outputs.items()):
309- value = resolve_path_traits(result.outputs.trait(trait_name), old,
310- results_file.parent)
311- if value != old: # Workaround #2968: Reset only changed values
310+ if isdefined( old):
311+ value = resolve_path_traits(result.outputs.trait(trait_name), old,
312+ results_file.parent)
312313 setattr(result.outputs, trait_name, value)
313314
314315 return result, aggregate, attribute_error
0 commit comments