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.

Cannot write the dashboard: 'ascii' codec can't encode characters in position 5-7: ordinal not in range(128)

See original GitHub issue

From this comment:

Traceback (most recent call last):
File "", line 357, in render
UnicodeEncodeError: 'ascii' codec can't encode characters in position 5-7: ordinal not in range(128)

GDB 7.7 with Python 2.7.4 3.4.0

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
cyrus-andcommented, Dec 3, 2016

I can only reproduce your issue on a machine where the locale is set to C, basically no locale, but I’m able to fix the behavior by exporting the UTF-8 variant before starting GDB, in my case:

export LC_CTYPE=C.UTF-8

For example:

$ gdb -nx -ex 'python with open("/dev/null") as f: print(f.encoding)' -ex quit
ANSI_X3.4-1968
$ export LC_CTYPE=C.UTF-8
$ gdb -nx -ex 'python with open("/dev/null") as f: print(f.encoding)' -ex quit
UTF-8

Can you try to run:

gdb -nx -ex 'python with open("/dev/null") as f: print(f.encoding)' -ex quit
0reactions
cyrus-andcommented, Dec 3, 2016

Good! Now, I’m not sure whether this is a thing I should fix myself or not, to my knowledge Python falls back to that encoding when it cannot figure out the proper encoding from the environment, so probably you’re experiencing this because your setup is not UTF-8-ready…

Anyway, you can use an alias, in your .bashrc or whatever so you don’t have to export it every time, plus in this way it will only affect GDB:

alias gdb='LC_CTYPE=C.UTF-8 gdb'

I’m closing this for now. Thanks for your patience!

Read more comments on GitHub >

github_iconTop Results From Across the Web

'ascii' codec can't encode character : ordinal not in range (128)
Your problem is that, in Python 2, a file object (as returned by open() ) can only write str objects, not unicode objects....
Read more >
'ascii' codec can't decode byte 0xe4 in position 11: ordinal not ...
Turns out the root cause of this issue is that the new pyparted build's python modules return unicode objects instead of (byte) strings...
Read more >
ascii codec can't encode characters in position 57-65: ordinal not in ...
ascii codec can't encode characters in position 57 -65: ordinal not in range in range (128). Versions. OS: Windows 7 Professional Rus ...
Read more >
Bug listing with status RESOLVED with resolution OBSOLETE ...
UTF-8 - UnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in position 27: ordinal not in range(128): [...]" status:RESOLVED resolution:OBSOLETE ...
Read more >
'ascii' codec can't encode character u'\u03b1' in position 20 ...
As the error message suggests the error is being caused because of encoding. · In csv files all values are separated by commas,...
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