Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mac automator error message #29

Open
wuziqiqiqi opened this issue Sep 18, 2020 · 5 comments
Open

Mac automator error message #29

wuziqiqiqi opened this issue Sep 18, 2020 · 5 comments

Comments

@wuziqiqiqi
Copy link

UnicodeEncodeError: 'ascii' codec can't encode character '\u03b1' in position 0: ordinal not in range(128)”

@svenkreiss
Copy link
Owner

I haven't seen this error before. Are you using Python2? This is for Python 3 only.

@peterparity
Copy link

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

@svenkreiss
Copy link
Owner

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.

@peterparity
Copy link

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.

@svenkreiss
Copy link
Owner

Very helpful. Thanks! I'll try to put some clarification in the readme.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants