diff --git a/nipype/interfaces/base.py b/nipype/interfaces/base.py index 188053c639..be0bad3a6f 100644 --- a/nipype/interfaces/base.py +++ b/nipype/interfaces/base.py @@ -1243,7 +1243,7 @@ def read(self, drain=0): def _read(self, drain): "Read from the file descriptor" fd = self.fileno() - buf = os.read(fd, 4096).decode(self.default_encoding) + buf = os.read(fd, 4096).decode(self.default_encoding, errors='backslashreplace') if not buf and not self._buf: return None if '\n' not in buf: @@ -1507,8 +1507,8 @@ def _process(drain=0): proc.poll() time.sleep(interval) stdout, stderr = proc.communicate() - stdout = stdout.decode(default_encoding) - stderr = stderr.decode(default_encoding) + stdout = stdout.decode(default_encoding, errors='backslashreplace') + stderr = stderr.decode(default_encoding, errors='backslashreplace') result['stdout'] = stdout.split('\n') result['stderr'] = stderr.split('\n') result['merged'] = '' @@ -1522,8 +1522,8 @@ def _process(drain=0): ret_code = proc.wait() stderr.flush() stdout.flush() - result['stdout'] = [line.decode(default_encoding).strip() for line in open(outfile, 'rb').readlines()] - result['stderr'] = [line.decode(default_encoding).strip() for line in open(errfile, 'rb').readlines()] + result['stdout'] = [line.decode(default_encoding, errors='backslashreplace').strip() for line in open(outfile, 'rb').readlines()] + result['stderr'] = [line.decode(default_encoding, errors='backslashreplace').strip() for line in open(errfile, 'rb').readlines()] result['merged'] = '' if output == 'none': if runtime_profile: @@ -1677,7 +1677,7 @@ def cmdline(self): return ' '.join(allargs) def raise_exception(self, runtime): - raise RuntimeError( + raise RuntimeError( ('Command:\n{cmdline}\nStandard output:\n{stdout}\n' 'Standard error:\n{stderr}\nReturn code: {returncode}').format( **runtime.dictcopy())) diff --git a/nipype/interfaces/mrtrix3/preprocess.py b/nipype/interfaces/mrtrix3/preprocess.py index 8f96154909..16c2a29ae3 100644 --- a/nipype/interfaces/mrtrix3/preprocess.py +++ b/nipype/interfaces/mrtrix3/preprocess.py @@ -97,11 +97,10 @@ class ResponseSD(MRTrix3Base): >>> resp.inputs.in_mask = 'mask.nii.gz' >>> resp.inputs.grad_fsl = ('bvecs', 'bvals') >>> resp.cmdline # doctest: +ELLIPSIS +IGNORE_UNICODE - 'dwi2response -fslgrad bvecs bvals -mask mask.nii.gz dwi.mif response.txt' >>> resp.run() # doctest: +SKIP """ - _cmd = 'dwi2response' + _cmd = 'dwi2response tax' input_spec = ResponseSDInputSpec output_spec = ResponseSDOutputSpec