Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UnicodeEncodeError: 'ascii' codec can't encode characters in position 21-25: ordinal not in range(128) #30

Open
lancexiang opened this issue Sep 20, 2019 · 0 comments

Comments

@lancexiang
Copy link

File "/Users/lance/anaconda2/lib/python2.7/site-packages/yacs/config.py", line 513, in _check_and_coerce_cfg_value_type
    original_type, replacement_type, original, replacement, full_key

The error occurs in merge_from_file('xxx.yml') when I defined a path='' in the default config and in the xxx.yml setting with path: '你好' in chinese.

I have debug this, it seems that in python 2.x, the yaml package safe_load method will auto convert the str with chinese to unicode, so in this case, str mismatch with unicode.

Although I can redefined path=u'' to solve the problem for python2, but it really not pythonic, so I think it's a small bug. Can you fix the bug for python2.x?

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant