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

"_curses.error: addstr() returned ERR" issue when printing tsv files that has long width #132

Open
njql007 opened this issue Feb 8, 2016 · 6 comments

Comments

@njql007
Copy link

njql007 commented Feb 8, 2016

Hello there,

After opening a tsv file, when scrolling right, the app crashed and I got this exception.

$ tabview ~/test
Traceback (most recent call last):
  File "/home/lqu/.local/bin/tabview", line 5, in <module>
    pkg_resources.run_script('tabview==1.4.2', 'tabview')
  File "/packages/encap/py_setuptools-0.6c11_py2.7/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/pkg_resources.py", line 489, in run_script
  File "/packages/encap/py_setuptools-0.6c11_py2.7/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/pkg_resources.py", line 1207, in run_script
  File "/home/lqu/.local/lib/python2.7/site-packages/tabview-1.4.2-py2.7.egg/EGG-INFO/scripts/tabview", line 108, in <module>
    delimiter=args.delimiter, quoting=args.quoting)
  File "/home/lqu/.local/lib/python2.7/site-packages/tabview-1.4.2-py2.7.egg/tabview/tabview.py", line 1332, in view
    info=info)
  File "/usr/local/lib/python2.7/curses/wrapper.py", line 43, in wrapper
    return func(stdscr, *args, **kwds)
  File "/home/lqu/.local/lib/python2.7/site-packages/tabview-1.4.2-py2.7.egg/tabview/tabview.py", line 1253, in main
    Viewer(stdscr, *args, **kwargs).run()
  File "/home/lqu/.local/lib/python2.7/site-packages/tabview-1.4.2-py2.7.egg/tabview/tabview.py", line 700, in run
    self.display()
  File "/home/lqu/.local/lib/python2.7/site-packages/tabview-1.4.2-py2.7.egg/tabview/tabview.py", line 856, in display
    addstr(self.scr, yc, xc, s, attr)
  File "/home/lqu/.local/lib/python2.7/site-packages/tabview-1.4.2-py2.7.egg/tabview/tabview.py", line 39, in addstr
    return scr.addstr(*args)
_curses.error: addstr() returned ERR

It happens only when the tsv file is at least full screen height, and the width is long enough.

I changed this line to if yc == self.max_y - 1:, (which probably means always use insstr() for rendering bottom line of the window?), then it will go through for any files for me.

@firecat53
Copy link
Collaborator

Any chance you could supply a sample file that triggers this crash? I open lots of big CSV files that are wider and taller than the screen without errors.

Also, what platform and terminal are you running on?

Thanks!
Scott

@njql007
Copy link
Author

njql007 commented Feb 9, 2016

Hello, I can't upload the file so I put it here. If you open the file using tabview in some specific window width & height combination, it will crash. You can try opening the file through tabview and then use the mouse to resize the window of your terminal.

I'm running Mac OS X El Capitan on a Macbook Pro, using iTerm and ssh'ed to a CentOS box (release 5.6).

Thanks!

@firecat53
Copy link
Collaborator

Well hrm. I can't get it to fail at all. I've tried both urxvt and xterm. I tried the file you sent and I tried my weirdest unicode test file (in the sample directory...and I made it bigger and wider too). I tried resizing the terminals. Nothing made it quit. I tried with the change you made and it also didn't crash.

I'm a little hesitant to permanently change the line you modified since it was added when we added double-width character support (#92). @wavexx, any thoughts?

Scott

@wavexx
Copy link
Member

wavexx commented Feb 10, 2016 via email

@njql007
Copy link
Author

njql007 commented Feb 10, 2016

Hello, thanks for helping me out! It happens when I'm reducing the height of the window (so that the characters will fill up the window, and that's why I put 73 lines in the file).

$ echo $LINES $COLUMNS
73 181

$ env | egrep 'LC_|LANG'
LANG=en_US.UTF-8

@wavexx
Copy link
Member

wavexx commented Feb 10, 2016

@firecat53 I'm bit busy right now, but this should be enough to trigger it again.

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