question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

UnicodeDecode Error

See original GitHub issue

Got this problem when I tried to update an issue with a new comment:

Traceback (most recent call last):
  File "/Users/yash/.pyenv/versions/2.7.10/bin/statuspage", line 11, in <module>
    sys.exit(cli())
  File "/Users/yash/.pyenv/versions/2.7.10/lib/python2.7/site-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/Users/yash/.pyenv/versions/2.7.10/lib/python2.7/site-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/Users/yash/.pyenv/versions/2.7.10/lib/python2.7/site-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/yash/.pyenv/versions/2.7.10/lib/python2.7/site-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/yash/.pyenv/versions/2.7.10/lib/python2.7/site-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/Users/yash/.pyenv/versions/2.7.10/lib/python2.7/site-packages/statuspage/statuspage.py", line 73, in update
    run_update(name=name, token=token, org=org)
  File "/Users/yash/.pyenv/versions/2.7.10/lib/python2.7/site-packages/statuspage/statuspage.py", line 211, in run_update
    if is_same_content(content, base64.b64decode(index.content)):
  File "/Users/yash/.pyenv/versions/2.7.10/lib/python2.7/site-packages/statuspage/statuspage.py", line 478, in is_same_content
    return sha1(c1).hexdigest() == sha1(c2).hexdigest()
  File "/Users/yash/.pyenv/versions/2.7.10/lib/python2.7/site-packages/statuspage/statuspage.py", line 476, in sha1
    c = c.encode("utf-8")
UnicodeDecodeError: 'ascii' codec can't decode byte 0xf0 in position 2735: ordinal not in range(128)

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
martignonicommented, Aug 2, 2017

I can now reproduce the bug:

  1. Create a new issue with some UTF8 character in the title and/or the description
  2. Update status in the usual way (statuspage update in terminal)
  3. Update works correctly, and status page displays the issue correctly (with UTF8 chars)
  4. Make any issue modification (in the same issue or another) and update status
  5. Error occurs
  6. Manually edit index.html, changing the UTF8 chars with ASCII chars (e.g. é -> e, à -> a), save file
  7. Update status again in the usual way (statuspage update in terminal)
  8. No error is displayed

So the errors seems to occur when a UTF8 char is present in the index.html file and statuspage.py tries to read it.

Maybe this error: https://stackoverflow.com/questions/3235386/python-using-format-on-a-unicode-escaped-string

0reactions
martignonicommented, Jun 17, 2017

Just getting this error too, with Python 2.7.13.

Traceback (most recent call last):
  File "/usr/local/bin/statuspage", line 11, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/statuspage/statuspage.py", line 73, in update
    run_update(name=name, token=token, org=org)
  File "/usr/local/lib/python2.7/site-packages/statuspage/statuspage.py", line 211, in run_update
    if is_same_content(content, base64.b64decode(index.content)):
  File "/usr/local/lib/python2.7/site-packages/statuspage/statuspage.py", line 478, in is_same_content
    return sha1(c1).hexdigest() == sha1(c2).hexdigest()
  File "/usr/local/lib/python2.7/site-packages/statuspage/statuspage.py", line 476, in sha1
    c = c.encode("utf-8")
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 2089: ordinal not in range(128)
Read more comments on GitHub >

github_iconTop Results From Across the Web

UnicodeDecodeError - Python Wiki
The UnicodeDecodeError normally happens when decoding an str string from a certain coding. Since codings map only a limited number of str ...
Read more >
How to fix: "UnicodeDecodeError: 'ascii' codec can't decode ...
UnicodeDecodeError : 'ascii' codec can't decode byte generally happens when you try to convert a Python 2.x str that contains non-ASCII to a...
Read more >
UnicodeDecodeError utf-8 codec can t decode byte in position ...
While I importing the file it shows UnicodeDecodeError: "utf-8" codec can"t decode byte 0xa0 in position ... as pd a ...
Read more >
'utf-8' codec can't decode byte 0xff in position 0: invalid start byte
UnicodeDecodeError : 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte solved in Django .The error is on the line ......
Read more >
How to resolve a UnicodeDecodeError for a CSV file - Kaggle
_string_box_utf8() UnicodeDecodeError: 'utf-8' codec can't decode byte 0xcc in position 1: invalid continuation byte During handling of the above exception, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found