Visidata: AttributeError: '_curses.window' object has no attribute 'get_wch'

Created on 10 Aug 2018  路  12Comments  路  Source: saulpw/visidata

I'm having trouble with the version of visidata available through the conda-forge conda channel (https://github.com/conda-forge/visidata-feedstock/):

(CC @anjakefala as visidata conda-forge maintainer)

Installing visidata 1.2.1 using conda create -n visidata visidata and executing it yields the following error. I can reproduce this on both Ubuntu 16.04 and CentOS 7. From searching, this seemed to be an error common with Python <3.3, but the version here used Python 3.7.

$ vd
Traceback (most recent call last):
  File "/home/chris/miniconda3/envs/visidata/bin/vd", line 152, in <module>
    main()
  File "/home/chris/miniconda3/envs/visidata/bin/vd", line 130, in main
    vdtui.run(*sources)
  File "/home/chris/miniconda3/envs/visidata/lib/python3.7/site-packages/visidata/vdtui.py", line 2787, in run
    ret = wrapper(cursesMain, sheetlist)
  File "/home/chris/miniconda3/envs/visidata/lib/python3.7/site-packages/visidata/vdtui.py", line 2777, in wrapper
    return curses.wrapper(setupcolors, f, *args)
  File "/home/chris/miniconda3/envs/visidata/lib/python3.7/curses/__init__.py", line 94, in wrapper
    return func(stdscr, *args, **kwds)
  File "/home/chris/miniconda3/envs/visidata/lib/python3.7/site-packages/visidata/vdtui.py", line 2774, in setupcolors
    return f(stdscr, *args)
  File "/home/chris/miniconda3/envs/visidata/lib/python3.7/site-packages/visidata/vdtui.py", line 2800, in cursesMain
    return vd().run(_scr)
  File "/home/chris/miniconda3/envs/visidata/lib/python3.7/site-packages/visidata/vdtui.py", line 932, in run
    keystroke = self.getkeystroke(scr, sheet)
  File "/home/chris/miniconda3/envs/visidata/lib/python3.7/site-packages/visidata/vdtui.py", line 771, in getkeystroke
    k = scr.get_wch()
AttributeError: '_curses.window' object has no attribute 'get_wch'

The exact software versions installed in the environment used by visidata are as follows:

$ conda list -n visidata
# packages in environment at /home/chris/miniconda3/envs/visidata:
#
# Name                    Version                   Build  Channel
asn1crypto                0.24.0                     py_1    conda-forge
bzip2                     1.0.6                h470a237_2    conda-forge
ca-certificates           2018.4.16                     0    conda-forge
certifi                   2018.4.16                py37_0    conda-forge
cffi                      1.11.5           py37h5e8e0c9_1    conda-forge
chardet                   3.0.4                    py37_3    conda-forge
cryptography              2.3              py37hdffb7b8_0    conda-forge
cryptography-vectors      2.3                      py37_1    conda-forge
et_xmlfile                1.0.1                    py37_0  
icu                       58.2                 hfc679d8_0    conda-forge
idna                      2.7                      py37_2    conda-forge
jdcal                     1.4                        py_1    conda-forge
libffi                    3.2.1                         3    conda-forge
libgcc-ng                 7.2.0                hdf63c60_3  
libiconv                  1.15                 h470a237_1    conda-forge
libstdcxx-ng              7.2.0                hdf63c60_3  
libxml2                   2.9.8                h422b904_2    conda-forge
libxslt                   1.1.32               h88dbc4e_1    conda-forge
lxml                      4.2.4            py37hc9114bc_0    conda-forge
ncurses                   6.1                  hfc679d8_1    conda-forge
openpyxl                  2.5.5                      py_0    conda-forge
openssl                   1.0.2o               h470a237_1    conda-forge
pip                       18.0                     py37_1    conda-forge
pycparser                 2.18                       py_1    conda-forge
pyopenssl                 18.0.0                   py37_0    conda-forge
pysocks                   1.6.8                    py37_0  
python                    3.7.0                h5001a0f_0    conda-forge
python-dateutil           2.7.3                      py_0    conda-forge
readline                  7.0                  haf1bffa_1    conda-forge
requests                  2.19.1                   py37_1    conda-forge
setuptools                40.0.0                   py37_1    conda-forge
six                       1.11.0                   py37_1    conda-forge
sqlite                    3.24.0               h2f33b56_0    conda-forge
tk                        8.6.8                         0    conda-forge
urllib3                   1.23                     py37_1    conda-forge
visidata                  1.2.1                    py37_2    conda-forge
wheel                     0.31.1                   py37_1    conda-forge
xlrd                      1.1.0                      py_2    conda-forge
xz                        5.2.4                h470a237_0    conda-forge
zlib                      1.2.11               h470a237_3    conda-forge

Most helpful comment

I came across this problem too.
I found the source.
I typically run my own build of Python from source (on Ubuntu).

The presence of this function appears to be conditional on an autoconf value: HAVE_NCURSESW
https://github.com/python/cpython/blob/master/Modules/_cursesmodule.c#L1455

ncursesw is ncurses w/ UTF8 support.

I installed that build of curses:

sudo apt-get install libncursesw5-dev

and rebuilt Python from sources (as I do in my normal install; here v3.8.5).
Witnessed these in config.log:

configure:15927: gcc -pthread -c   -I/usr/include/ncursesw conftest.c >&5

Installing visidata from the standard Python build on my machine also works .

All 12 comments

Thank you so much for such a thorough bug report @cbrueffer!

This is especially interesting because visidata v1.2.1 launches fine on my MacOs with homebrewed Python3.7. We suspect it may have something to do with the conda version of Python.

I am going to set up and configure a conda environment that matches yours and look into this.

Thanks! Happy to help debug this further if you have suggestions. FWIW, I got the same error with the 1.2.0 package.

Hi @cbrueffer!

Sorry for the delayed response. =) I have been trying to reproduce this bug and failing.

I have tried:

  • loading up an Ubuntu VM
  • setting up a miniconda environment for Python3
  • configuring conda-forge
  • installing VisiData

It opened up and loaded without issue.

I would love to debug this alongside you. It seems the issue has to do with some specific component of your environment and is not necessarily visidata-feedstock specific.

Closing this issue for now, please reopen if it's still troublesome.

@cbrueffer With pyenv I fixed it as follows: https://github.com/saulpw/visidata/issues/192#issuecomment-426321712

@saulpw I have just did 1.5 update, and now I have AttributeError: '_curses.window' object has no attribute 'get_wch' with an xls file that I opened without error.

I have Python 3.6.6 with debian stretch

Hi @aborruso, did you try the installing libncurses packages as in https://github.com/saulpw/visidata/issues/192#issuecomment-426321712 ?

@aborruso, is this problem new with 1.5 for you? That is, you had 1.4 previously installed on this same machine, and it worked fine, and then you upgraded, and now it does not work at all?

Hi @saulpw yes, but I have this https://github.com/saulpw/visidata/issues/192#issuecomment-435650576

I had 1.3.1 installed and it worked. But now I have uninstalled vd and force 1.3.1 and it does not work.

Thank you

I was able to reproduce this error with the latest package on conda-forge.

$ python --version
Python 3.6.6
$ vd --version
saul.pw/VisiData v1.5
$ vd
Traceback (most recent call last):
  ...
  File ".../lib/python3.6/site-packages/visidata/vdtui.py", line 734, in getkeystroke
    k = scr.get_wch()
AttributeError: '_curses.window' object has no attribute 'get_wch'

@mbarkhau Thanks for the report. A few different things have been tried, please let us know if one of them works or if you figure out another way to fix this issue!

I came across this problem too.
I found the source.
I typically run my own build of Python from source (on Ubuntu).

The presence of this function appears to be conditional on an autoconf value: HAVE_NCURSESW
https://github.com/python/cpython/blob/master/Modules/_cursesmodule.c#L1455

ncursesw is ncurses w/ UTF8 support.

I installed that build of curses:

sudo apt-get install libncursesw5-dev

and rebuilt Python from sources (as I do in my normal install; here v3.8.5).
Witnessed these in config.log:

configure:15927: gcc -pthread -c   -I/usr/include/ncursesw conftest.c >&5

Installing visidata from the standard Python build on my machine also works .

Was this page helpful?
0 / 5 - 0 ratings