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: #9

Closed
jetheurer opened this issue Feb 25, 2015 · 4 comments
Closed

UnicodeEncodeError: #9

jetheurer opened this issue Feb 25, 2015 · 4 comments

Comments

@jetheurer
Copy link
Contributor

I was getting this error:

Traceback (most recent call last):
  File "generate.py", line 289, in <module>
    main()
  File "generate.py", line 284, in main
    process_resume(LATEX_CONTEXT, yaml_data, args.preview)
  File "generate.py", line 255, in process_resume
    context.write_to_outfile(rendered_resume)
  File "generate.py", line 209, in write_to_outfile
    out.write(output_data)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 1387: ordinal not in range(128)

is fixed with:

output_data = output_data.encode('utf-8')
@bamos bamos closed this as completed in 08f2c58 Feb 25, 2015
bamos added a commit that referenced this issue Feb 25, 2015
@bamos bamos reopened this Feb 25, 2015
bamos added a commit that referenced this issue Feb 25, 2015
@bamos
Copy link
Owner

bamos commented Feb 25, 2015

Thanks for the report and fix @jetheurer!

Can you see if it still works for you?
I changed the open to binary mode to
fix the following error in Arch Linux:

cv(master*)$ m build/cv.md
./generate.py cv.yaml
  + Processing section: interests
  + Processing section: education
  + Processing section: research
  + Processing section: teaching
  + Processing section: publications
  + Processing section: industry
  + Processing section: skills
  + Processing section: honors
Traceback (most recent call last):
  File "./generate.py", line 290, in <module>
    main()
  File "./generate.py", line 285, in main
    process_resume(LATEX_CONTEXT, yaml_data, args.preview)
  File "./generate.py", line 256, in process_resume
    context.write_to_outfile(rendered_resume)
  File "./generate.py", line 210, in write_to_outfile
    out.write(output_data)
TypeError: must be str, not bytes
Makefile:31: recipe for target 'build/cv.md' failed
make: *** [build/cv.md] Error 1

@bamos
Copy link
Owner

bamos commented Feb 26, 2015

Also @jetheurer - I think this bug was hidden in my system
because my LOCALE includes UTF-8.
My guess is that your LOCALE doesn't,
and I think I've run into this in another project when
running code on different computers.
Would be nice for Python to tell me about this
incompatibility. :-)

~$ echo $LANGUAGE $LC_ALL $LC_CTYPE $LANG
en_US.UTF-8 en_US.UTF-8

@bamos
Copy link
Owner

bamos commented Mar 9, 2015

@jetheurer - I'm closing this issue because I think this issue is resolved.
Ping me if something isn't working for you.

@bamos bamos closed this as completed Mar 9, 2015
@jetheurer
Copy link
Contributor Author

ah sorry Brandon, I havent gotten around to checking it yet.

Liz

On Mon, Mar 9, 2015 at 10:41 AM, Brandon Amos [email protected]
wrote:

Closed #9 #9.


Reply to this email directly or view it on GitHub
#9 (comment).

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

2 participants