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

UnicodeEncodeError: 'latin-1' codec can't encode character #50

Open
alopezespino opened this issue Jun 24, 2021 · 0 comments
Open

UnicodeEncodeError: 'latin-1' codec can't encode character #50

alopezespino opened this issue Jun 24, 2021 · 0 comments

Comments

@alopezespino
Copy link

I had this issue, and I'm posting the solution here in case someone has the same problem.

After configuring zotcli, I did my first query and got the following error.

Traceback (most recent call last): File "/Users/ale/miniconda3/bin/zotcli", line 8, in <module> sys.exit(cli()) File "/Users/ale/miniconda3/lib/python3.8/site-packages/click/core.py", line 1137, in __call__ return self.main(*args, **kwargs) File "/Users/ale/miniconda3/lib/python3.8/site-packages/click/core.py", line 1062, in main rv = self.invoke(ctx) File "/Users/ale/miniconda3/lib/python3.8/site-packages/click/core.py", line 1668, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/Users/ale/miniconda3/lib/python3.8/site-packages/click/core.py", line 1404, in invoke return ctx.invoke(self.callback, **ctx.params) File "/Users/ale/miniconda3/lib/python3.8/site-packages/click/core.py", line 763, in invoke return __callback(*args, **kwargs) File "/Users/ale/miniconda3/lib/python3.8/site-packages/click/decorators.py", line 26, in new_func return f(get_current_context(), *args, **kwargs) File "/Users/ale/miniconda3/lib/python3.8/site-packages/zotero_cli/cli.py", line 183, in query click.echo(out) File "/Users/ale/miniconda3/lib/python3.8/site-packages/click/utils.py", line 298, in echo file.write(out) # type: ignore UnicodeEncodeError: 'latin-1' codec can't encode character '\ufb01' in position 28: ordinal not in range(256)

This is a python issue with special characters in Zotero references that clash with my default python encoding.

I fixed this by changing the following environment variable:

export PYTHONIOENCODING=utf8

I hope it helps others that come across the same issue!

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

1 participant