Thanks to visit codestin.com
Credit goes to github.com

Skip to content

nipype raising UnicodeEncodeError; fixed when writing files with encoding='utf-8' #2942

Closed
@binarybottle

Description

@binarybottle

Summary

When running nipy/mindboggle, nipype raises a UnicodeEncodeError in multiple places where files are written. This is fixed when adding "encoding='utf-8'".

Actual behavior

Here are three instances in two files:

File "/opt/miniconda-latest/envs/mb/lib/python3.6/site-packages/nipype/utils/filemanip.py", line 694, in crash2txt
fp.write('Node inputs:\n{}\n'.format(node.inputs))
UnicodeEncodeError: 'ascii' codec can't encode character '\u2019' in position 495764: ordinal not in range(128)

File "/opt/miniconda-latest/envs/mb/lib/python3.6/site-packages/nipype/pipeline/engine/utils.py", li
ne 225, in write_report

File "/opt/miniconda-latest/envs/mb/lib/python3.6/site-packages/nipype/pipeline/engine/utils.py", line 141, in write_report
fp.write('\n'.join(lines))
UnicodeEncodeError: 'ascii' codec can't encode character '\u2019' in position 1765: ordinal not in range(128)

Expected behavior

How to replicate the behavior

Script/Workflow details

Please put URL to code or code here (if not too long).

Platform details:

neurodocker.sh:
--miniconda
conda_install="python=3.6 pip jupyter cmake mesalib vtk=8.2 pandas
matplotlib colormath nipype>=1.1.4 tbb-devel nose" \

nipype 1.2.0-py36_0

{'commit_hash': '%h',
 'commit_source': 'archive substitution',
 'networkx_version': '2.3',
 'nibabel_version': '2.4.1',
 'nipype_version': '1.2.0',
 'numpy_version': '1.16.4',
 'pkg_path': '/opt/miniconda-latest/envs/mb/lib/python3.6/site-packages/nipype',
 'scipy_version': '1.3.0',
 'sys_executable': '/opt/miniconda-latest/envs/mb/bin/python',
 'sys_platform': 'linux',
 'sys_version': '3.6.7 | packaged by conda-forge | (default, Feb 28 2019, '
                '09:07:38) \n'
                '[GCC 7.3.0]',
 'traits_version': '5.1.1'}

Execution environment

Choose one

  • Container [Tag: nipy/mindboggle]
  • My python environment inside container [Base Tag: ???]
    Python 3.6.7 | packaged by conda-forge | (default, Feb 28 2019, 09:07:38)
  • My python environment outside container

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions