When piping the output of a Python program, the Python interpreter gets confused about encoding and sets it to None. This means a program like this:
# -*- co
On Windows, I had this problem very often when running a Python code from an editor (like Sublime Text), but not if running it from command-line.
In this case, check your editor's parameters. In the case of SublimeText, this Python.sublime-build
solved it:
{
"cmd": ["python", "-u", "$file"],
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
"selector": "source.python",
"encoding": "utf8",
"env": {"PYTHONIOENCODING": "utf-8", "LANG": "en_US.UTF-8"}
}