Skip to content

Add encoding='utf-8' to open() #5

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

kuraha4
Copy link

@kuraha4 kuraha4 commented Feb 6, 2021

My environment:
Windows 10 (Japanese system locale), Inkscape 1.01

Problem:
When I run the extension in Inkscape, generator.py throws an error like this:

Traceback (most recent call last):
  File "generator.py", line 382, in <module>
    globaldata.template = f.read()
UnicodeDecodeError: 'cp932' codec can't decode byte 0x89 in position 616: illegal multibyte sequence

Solution:
Added encoding='utf-8' argument to open() and the extension worked fine for me.

FYI, this section of the doc has an example in regards to the system default encoding.
https://docs.python.org/3/library/csv.html#examples

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

Successfully merging this pull request may close these issues.

1 participant