CircleCI with Python in Docker - Tests



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?

My code:

some_file = path + '/some_file_name'

for line in some_file:

updated_file =, 'r')
file_contents =

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.


Yeah, I’d try using a base image that matches the OS you have locally. Moreover, what version of Python are you running? I’d start by checking for major version changes - you’re not running 2.x on one and 3.x on the other, by any chance?


Both have python 2.7.14. CircleCI 1.0 is not compatible with Ubuntu 16.x as far as I know.

closed #4