Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
"UnicodeDecodeError: 'ascii' codec can't decode byte" #143
Problem occurs under Windows OS and for environment where configurable encoding is used (non UTF-8 paths).
import sys sys.getdefaultencoding()
Try this hook for
def get_home_dir(): home_dir = _get_projconf_option_dir( "home_dir", join(expanduser("~"), ".platformio") ) import sys home_dir = home_dir.decode(sys.getfilesystemencoding()) if not isdir(home_dir): os.makedirs(home_dir) assert isdir(home_dir) return home_dir
How to reproduce? Just create account with "non-UTF-8" chars (Cyrillic is good candidate).
changed the title
Fix "UnicodeDecodeError: 'ascii' codec can't decode byte"
Mar 27, 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 or set global PLATFORMIO_HOME_DIR system environment variable. PlatformIO uses user's home directory by default, which can contain "non-latin" characters. The easy way is to set
[platformio] home_dir = C:\.platformio [env:your_env_here] ....
NOTICE: All PlatformIO based commands should be executed within that project directory, where
@ivankravets This error is also triggered by storing project in path containing non-latin characters. The workaround is (obviously) to store projects elsewhere or creating symlink (directory junction) so that PlatformIO does not have to deal with non-latin paths.
PS in my case it was 'utf8' codec, not 'ascii'.