Skip to content

Error in dvc pull due to python encoding #3629

@vss96

Description

@vss96

Hey, I was trying to pull in some images from a DVC file and this ended up happening

dvc pull sample.dvc
ERROR: unexpected error - 'ascii' codec can't encode characters in position 111-113: ordinal not in range(128)
DVC version: 0.93.0
Python version: 3.6.9
Platform: Linux-4.4.0-1105-aws-x86_64-with-Ubuntu-16.04-xenial
Binary: False
Package: snap
Supported remotes: azure, gdrive, gs, hdfs, http, https, s3, ssh, oss
Cache: reflink - not supported, hardlink - supported, symlink - supported
Repo: dvc, git

Solution: Make sure the following environment variables are set.

LC_ALL=en_US.UTF-8
LANG=en_US.UTF-8

Execute the following lines and it should not error out. This means that the above issue won't occur as well.

>>> import os
>>> import sys
>>>
>>> print(sys.getdefaultencoding())
utf-8
>>> print(os.path.exists("\xe2\u20ac\u201c-january-\xe2\u20ac\u201c"))
False

Metadata

Metadata

Assignees

No one assigned

    Labels

    triageNeeds to be triaged

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions