Dwifslpreproc error on a cluster

Hi, I’m using mrtrix on a hpc.
Run into the error below when eddy_cuda fails (which is expected since I’m not on a GPU node) and should continue to eddy_openmp.

Any suggestions for a fix?

Thanks in advance!

Command:  eddy_cuda9.1 --imain=eddy_in.nii --mask=eddy_mask.nii --acqp=eddy_config.txt --index=eddy_indices.txt --bvecs=bvecs --bvals=bvals --topup=field --cnr_maps --residuals --slm=linear --repol --out=dwi_post_eddy --verbose

dwifslpreproc: [ERROR] Unhandled Python exception:
dwifslpreproc: [ERROR]   UnicodeEncodeError: 'ascii' codec can't encode character u'\ufffd' in position 75: ordinal not in range(128)
dwifslpreproc: [ERROR] Traceback:
dwifslpreproc: [ERROR]   /vsc-hard-mounts/leuven-data/329/vsc32905/apps/mrtrix3/bin/dwifslpreproc:914 (in execute())
dwifslpreproc: [ERROR]     eddy_output_file.write(str(exception_cuda))

I found a fix and share it with you.

This has to do with how python v2 and v3 differently handle unicode/ascii.

On the hpc, loading python3 fixed to error.

So, I believe it is a python 2.7 incompatibility.

Best regards,

Stefan Sunaert

1 Like

For anyone interested in this issue / thread, there is further information over on GitHub.

To use a specific encoding (e.g. ‘utf-8’) use the encoding argument for pandas to csv:

df.to_csv(file_name, sep='\t', encoding='utf-8')