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

IdentiCurse crashes: UnicodeError - ordinal not in range(128) #26

Open
mavjs opened this issue Nov 23, 2013 · 7 comments
Open

IdentiCurse crashes: UnicodeError - ordinal not in range(128) #26

mavjs opened this issue Nov 23, 2013 · 7 comments

Comments

@mavjs
Copy link

mavjs commented Nov 23, 2013

OS: Fedora 19
IdentiCurse version: 0.10-dev

Traceback:

Traceback (most recent call last):
  File "/usr/bin/identicurse", line 9, in <module>
    load_entry_point('identicurse==0.10-dev', 'console_scripts', 'identicurse')()
  File "/usr/lib/python2.7/site-packages/identicurse-0.10_dev-py2.7.egg/identicurse/__init__.py", line 130, in main
    IdentiCurse(additional_config)
  File "/usr/lib/python2.7/site-packages/identicurse-0.10_dev-py2.7.egg/identicurse/identicurse.py", line 467, in __init__
    curses.wrapper(self.initialise)
  File "/usr/lib64/python2.7/curses/wrapper.py", line 43, in wrapper
    return func(stdscr, *args, **kwds)
  File "/usr/lib/python2.7/site-packages/identicurse-0.10_dev-py2.7.egg/identicurse/identicurse.py", line 932, in initialise
    self.loop()
  File "/usr/lib/python2.7/site-packages/identicurse-0.10_dev-py2.7.egg/identicurse/identicurse.py", line 1155, in loop
    self.redraw()
  File "/usr/lib/python2.7/site-packages/identicurse-0.10_dev-py2.7.egg/identicurse/identicurse.py", line 756, in redraw
    self.status_bar.redraw()
  File "/usr/lib/python2.7/site-packages/identicurse-0.10_dev-py2.7.egg/identicurse/statusbar.py", line 42, in redraw
    self.window.addstr(0, 1, self.text.encode("utf-8"))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 13: ordinal not in range(128)

I just opened it and left it in another tab in terminator. And it randomly crashes. Not sure what's causing it. Although I woke up today and thought maybe because windigo has a weird symbol (☴) beside his name? :P

@moggers87
Copy link
Contributor

Looks like a double-encode bug - self.text is probably a str. Would be interested to see what breaks if you remove that encode("utf-8") :D

You get same error if you do: u"ich heiße moggers".encode("utf-8").encode("utf-8")

@mavjs
Copy link
Author

mavjs commented Nov 24, 2013

well, removed that encode("utf-8") and IdentiCurse seems to be running fine. O_O

@moggers87
Copy link
Contributor

The obvious fix is to revert c1c5ca4 - but I'm not sure what that's meant to fix.

Paging Dr. @reality

@Erkan-Yilmaz
Copy link

any update on this issue?

IdentiCurse version: 0.10-dev
Python 2.7.5+

Exception in thread Thread-28:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 808, in __bootstrap_inner
self.run()
File "/usr/local/lib/python2.7/dist-packages/identicurse-0.10_dev-py2.7.egg/identicurse/tabbage.py", line 108, in run
fun()
File "/usr/local/lib/python2.7/dist-packages/identicurse-0.10_dev-py2.7.egg/identicurse/identicurse.py", line 950, in end_update_tabs
self.status_bar.do_nothing()
File "/usr/local/lib/python2.7/dist-packages/identicurse-0.10_dev-py2.7.egg/identicurse/statusbar.py", line 47, in do_nothing
self.update("IdentiCurse: %s" % random.choice(config.session_store.slogans))
File "/usr/local/lib/python2.7/dist-packages/identicurse-0.10_dev-py2.7.egg/identicurse/statusbar.py", line 32, in update
self.redraw()
File "/usr/local/lib/python2.7/dist-packages/identicurse-0.10_dev-py2.7.egg/identicurse/statusbar.py", line 42, in redraw
self.window.addstr(0, 1, self.text.encode("utf-8"))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 13: ordinal not in range(128)
identicursebug

@mavjs
Copy link
Author

mavjs commented Sep 28, 2014

@moggers87 heh, it's been quite a while since I've used IdentiCurse, but I'm back on it on a mac. I've got the same issue if I leave the terminal for awhile. Temporary fix I've applied is to remove the encode("utf-8") like I mentioned before.

When I tried u"ich heiße moggers".encode("utf-8").encode("utf-8") I get a very similar error as the one in IdentiCurse.

>>> u"ich heiße moggers".encode("utf-8").encode("utf-8")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 7: ordinal not in range(128)

@moggers87
Copy link
Contributor

@mavjs would you mind testing that fix on linux too?

I'm not active on StatusNet, so I can't really help with debugging this issue any longer. However, I'm more than happy to merge pull requests.

@mavjs
Copy link
Author

mavjs commented Sep 28, 2014

Tried it out on my Fedora 20+Python 2.7.5 server. The same error appears. Obvious fix is to revert that commit.
I looked at the PRESET_SLOGANS, since I saw a snow man once, and thought it might be the one conflicting with that commit you mentioned. So, I tested it out, it seems it is & you don't need the encode("utf-8") on both line: 40 & 42 of statusbar.py

I tried out with just 2 PRESET_SLOGANS as below;

PRESET_SLOGANS = [
☃",                                                                                                               
"☃ === head to the nearest ENTRANCE and immediately call YOUR MUTANT FIRE DANCING MOON POSSE. Pregnant women and those with heart conditions are advised against using this software. head to the nearest ENTRANCE and immediately call YOUR MUTANT FIRE DANCING MOON POSSE. Pregnant women and those with heart conditions are advised against using this software. === ☃",
]

It seems if there is encode("utf-8") on both line 40 & 42 of statusbar.py, it crashes Identicurse. Otherwise, it works fine. (My $LANG is set as en_GB.UTF-8)

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

3 participants