This is a weird error that I am facing ONLY when running Python tests in CircleCI Docker mode. They work perfectly fine when running on local Docker machine. The only difference between Docker in CircleCI and local is the Ubuntu Version (14.04-CircleCi vs 16.04-Local). Could this be the reason for this issue?
some_file = path + '/some_file_name' for line in some_file: sys.stdout.write(line.replace("replace_this", variable_that_may_have_unicode_chars)) updated_file = io.open(some_file, 'r') file_contents = updated_file.read()
This is a minimal example that throws the following error:
UnicodeDecodeError: ‘ascii’ codec can’t decode byte 0xe8 in position 1: ordinal not in range(128)
If I use the encoding at one place, it starts throwing errors at other places where it worked earlier.