Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

_curses.error: addstr() returned ERR #316

Closed
arvedarved opened this issue Oct 27, 2016 · 7 comments
Closed

_curses.error: addstr() returned ERR #316

arvedarved opened this issue Oct 27, 2016 · 7 comments
Labels

Comments

@arvedarved
Copy link

Sometimes rtv terminates with the following exception,

Traceback (most recent call last):
  File "/usr/local/bin/rtv", line 9, in 
    load_entry_point('rtv==1.13.0', 'console_scripts', 'rtv')()
  File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 542, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2569, in load_entry_point
    return ep.load()
  File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2229, in load
    return self.resolve()
  File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2235, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/local/lib/python2.7/site-packages/rtv/__main__.py", line 169, in 
    sys.exit(main())
  File "/usr/local/lib/python2.7/site-packages/rtv/__main__.py", line 152, in main
    page.loop()
  File "/usr/local/lib/python2.7/site-packages/rtv/page.py", line 73, in loop
    self.draw()
  File "/usr/local/lib/python2.7/site-packages/rtv/page.py", line 344, in draw
    self._draw_content()
  File "/usr/local/lib/python2.7/site-packages/rtv/page.py", line 459, in _draw_content
    attr = self._draw_item(subwindow, data, subwin_inverted)
  File "/usr/local/lib/python2.7/site-packages/rtv/subreddit_page.py", line 232, in _draw_item
    self.term.add_line(win, text, row, 1, curses.A_BOLD)
  File "/usr/local/lib/python2.7/site-packages/rtv/terminal.py", line 275, in add_line
    window.addstr(row, col, text, *params)
_curses.error: addstr() returned ERR

I haven't really found a way to 100% reproduce this, but usually using rtv for 5-10 minutes results in one crash.

@michael-lazar
Copy link
Owner

Thanks for the report

@infmagic2047
Copy link

It looks like http://bugs.python.org/issue8243.

@arvedarved
Copy link
Author

i wrapped the call to addstr in try: except: pass and did not notice anything wrong so far. If there is no better solution, we might just ignore the exception

@michael-lazar
Copy link
Owner

This error pops every time the program tries to draw text outside of the screen bounds. Usually it's the result of an edge case like resizing the screen in the middle of a redraw or trying to view an abnormal comment. I haven't seen one in a long time, so I'm surprised that you're getting them so frequently. What subreddits are you usually viewing when this happens? It could be a unicode character width miscalculation if you're on non-english subs. You can also try running with the ``--ascii` flag and see if that fixes the problem.

@arvedarved
Copy link
Author

Yes it looks like it is related to unicode, with --ascii i don't get these crashes.

My unicode characters are horrible broken (I am just not sure, who is at fault, rtv or python)
All unicode characters are displayed with M-something. Eg. the character after "pts" before the time is displayed as M-b~@M-". Do you have any idea?

@michael-lazar
Copy link
Owner

It sounds like your python build was compiled against the wrong curses library. I've seen similar jumbled characters like that when I built my own version of python. My understanding is that there are 2 versions of curses, libncurses.so and libncursesw.so, and the latter needs to be linked to python for unicode support. Here's a bug report that talks about the issue https://bugs.python.org/issue4787. What OS are you using?

@michael-lazar
Copy link
Owner

I added a section to the FAQ, but this seems like it's outside of the control of rtv so I'm closing the issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants