Skip to content

UnicodeDecodeError cause by system encoding #13

Description

@WEGFan

When I try to export to a static image, the following error occurs but I still can get the image correctly.

Exception in thread Thread-4:
Traceback (most recent call last):
  File "D:\Program Files\Python36\lib\threading.py", line 916, in _bootstrap_inner
    self.run()
  File "D:\Program Files\Python36\lib\threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "D:\My Documents\GitHub\github-readme-codestats-widget\venv\lib\site-packages\kaleido\scopes\base.py", line 74, in _collect_standard_error
    val = self._proc.stderr.readline().decode('utf-8')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb9 in position 77: invalid start byte

So I debugged the line at val = self._proc.stderr.readline().decode('utf-8') and found that it should be decode as gb2312 because this is my system encoding.

I think this line should be changed to

os_encoding = locale.getpreferredencoding()
val = self._proc.stderr.readline().decode(os_encoding)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugsomething broken

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions