Open wuziqiqiqi opened 3 years ago
I haven't seen this error before. Are you using Python2? This is for Python 3 only.
I ran into the same issue. I solved it by setting the PYTHONIOENCODING
environment variable in the automator script, so it becomes:
PYTHONIOENCODING=UTF-8 /usr/local/bin/python3 -m unicodeit.cli $1
Thanks! This is very helpful @peterparity . I assumed this was a given on all Macs. Do you know what you normal io-encoding is? It seems it depends on the terminal. Do you mind sharing the output of:
python3 -c "import sys; print(sys.stdout.encoding)"
Mine says utf-8
already.
I think the problem for me is that I'm actually using a separately installed python 3 (using anaconda). When I run in the terminal I get UTF-8
for both the anaconda python and the system python. However, when I run inside of Mac automator, the system python gives utf-8
but the anaconda python gives US-ASCII
. I'm not sure why this is the case, but it explains why I'm seeing this error.
Very helpful. Thanks! I'll try to put some clarification in the readme.
UnicodeEncodeError: 'ascii' codec can't encode character '\u03b1' in position 0: ordinal not in range(128)”