diff --git a/dipy/workflows/multi_io.py b/dipy/workflows/multi_io.py index eca1aa5d99..12e5d6c391 100644 --- a/dipy/workflows/multi_io.py +++ b/dipy/workflows/multi_io.py @@ -175,9 +175,18 @@ def io_iterator_(frame, fnc, output_strategy="absolute", mix_names=False): Properly instantiated IOIterator object. """ + + # Create a new object that does not contain the ``self`` dict item + def _selfless_dict(_values): + return {key: val for key, val in _values.items() if key != "self"} + args, _, _, values = inspect.getargvalues(frame) args.remove("self") - del values["self"] + # Create a new object that does not contain the ``self`` dict item from the + # provided copy of the local symbol table returned by ``getargvalues``. + # Avoids attempting to remove it from the object returned by + # ``getargvalues``. + values = _selfless_dict(values) spargs, defaults = get_args_default(fnc)