Closed greut closed 7 years ago
Hi. Often, the default encoding defaults to ascii, which I think might break things. What happens if you set the env variable "PYTHONIOENCODING=UTF-8" before starting jupyter ?
from subprocess import Popen, PIPE
p = Popen(['python2', '-c', 'import sys; print(sys.stdin.encoding)'],
stdout=PIPE)
o, e = p.communicate()
print(o)
p = Popen(['python3', '-c', 'import sys; print(sys.stdin.encoding)'],
stdout=PIPE)
o, e = p.communicate()
print(o)
PYTHONIOENCODING=utf-8 jupyter notebook
, both of them prints utf-8
.None
and Python3 prints utf-8
Sorry. Completely missed this. So I am guessing it fails under Python 2 when PYTHONIOENCODING is not set ? Please provide a stacktrace and I'll have a look at this later.
Your fix might be enough there. However, I just want to make sure we don't miss anything... Also, there is a related issue to this where a warning is printed... I'll have to consider exactly how I'll handle this.
I'm going to considering this as an error in jupyter. I'm extremely wary of reverting to ascii under Python 2, as it can produce very strange behaviour. Closing.
I've encountered this problem calling
gitinspector
from asubprocess
withinjupyter
.sys.stdin.encoding
wasNone
, hence it failed.