Fix Windows "UnicodeDecodeError: 'ascii' codec can't decode byte" #143

ivankravets opened this Issue Mar 27, 2015 · 2 comments


None yet

2 participants


Problem occurs under Windows OS and for environment where configurable encoding is used (non UTF-8 paths).

import sys

Try this hook for platformio.util.get_home_dir:

def get_home_dir():
    home_dir = _get_projconf_option_dir(
        join(expanduser("~"), ".platformio")

    import sys
    home_dir = home_dir.decode(sys.getfilesystemencoding())

    if not isdir(home_dir):

    assert isdir(home_dir)
    return home_dir

How to reproduce? Just create account with "non-UTF-8" chars (Cyrillic is good candidate).

@ivankravets ivankravets added the bug label Mar 27, 2015
@ivankravets ivankravets self-assigned this Mar 27, 2015
@ivankravets ivankravets added this to the 1.4.0 milestone Mar 27, 2015
@ivankravets ivankravets changed the title from Fix "UnicodeDecodeError: 'ascii' codec can't decode byte" to Fix Windows "UnicodeDecodeError: 'ascii' codec can't decode byte" Mar 27, 2015
@ivankravets ivankravets added the URGENT label Mar 29, 2015
@ivankravets ivankravets assigned valeros and unassigned ivankravets Mar 29, 2015
@ivankravets ivankravets added wontfix and removed URGENT labels Mar 31, 2015
@ivankravets ivankravets assigned ivankravets and unassigned valeros Mar 31, 2015

We can fix this issue within PlatformIO source code, but problem still exists within SCons source code.


To avoid this issue please re-define PlatformIO home_dir in your project configuration file platformio.ini. PlatformIO uses user's home directory by default, which can contain "non-latin" characters. The easy way is to set home_dir with path, which doesn't contain "non-latin" chars:


home_dir = C:\.platformio


NOTICE: All PlatformIO based commands should be executed within that project directory, where home_dir is defined.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment