neovim / python-gui

Proof-of-concept Nvim GUI. Not maintained.
Apache License 2.0
75 stars 20 forks source link

pynvim alias #3

Closed leonardinius closed 7 years ago

leonardinius commented 8 years ago

bfredl commented 8 years ago

it is supposed to work with both python2 and python3 but the setup files might need to be updated. What happens if you do python -m neovim_gui.cli (on py2 and 3 respectively)?

leonardinius commented 8 years ago

on py2 everything is (y) - rather than absent pynvim

on py3 the following happens:

λ ~/ python3.4 -m neovim_gui.cli
Traceback (most recent call last):
  File "/usr/local/lib/python3.4/dist-packages/neovim_gui/gtk_ui.py", line 122, in wrapper
    self._flush()
  File "/usr/local/lib/python3.4/dist-packages/neovim_gui/gtk_ui.py", line 428, in _flush
    self._pending[0] = self._screen.row
AttributeError: 'NoneType' object has no attribute 'row'
Traceback (most recent call last):
  File "/usr/local/lib/python3.4/dist-packages/neovim_gui/gtk_ui.py", line 122, in wrapper
    self._flush()
  File "/usr/local/lib/python3.4/dist-packages/neovim_gui/gtk_ui.py", line 428, in _flush
    self._pending[0] = self._screen.row
AttributeError: 'NoneType' object has no attribute 'row'
Traceback (most recent call last):
  File "/usr/local/lib/python3.4/dist-packages/neovim_gui/gtk_ui.py", line 122, in wrapper
    self._flush()
  File "/usr/local/lib/python3.4/dist-packages/neovim_gui/gtk_ui.py", line 428, in _flush
    self._pending[0] = self._screen.row
AttributeError: 'NoneType' object has no attribute 'row'
Traceback (most recent call last):
  File "/usr/local/lib/python3.4/dist-packages/neovim_gui/gtk_ui.py", line 122, in wrapper
    self._flush()
  File "/usr/local/lib/python3.4/dist-packages/neovim_gui/gtk_ui.py", line 428, in _flush
    self._pending[0] = self._screen.row
AttributeError: 'NoneType' object has no attribute 'row'
Traceback (most recent call last):
  File "/usr/local/lib/python3.4/dist-packages/neovim_gui/ui_bridge.py", line 97, in apply_updates
    handler(*args)
  File "/usr/local/lib/python3.4/dist-packages/neovim_gui/gtk_ui.py", line 168, in _nvim_cursor_goto
    self._screen.cursor_goto(row, col)
AttributeError: 'NoneType' object has no attribute 'cursor_goto'

Exception ignored in: <bound method _UnixSubprocessTransport.__del__ of <_UnixSubprocessTransport pid=9384 stdin=<_UnixWritePipeTransport closed fd=9 closed> stdout=<_UnixReadPipeTransport closed fd=10 closed> stderr=<_UnixReadPipeTransport closed fd=12 closed>>>
Traceback (most recent call last):
  File "/usr/lib/python3.4/asyncio/base_subprocess.py", line 113, in __del__
AttributeError: 'NoneType' object has no attribute 'warn'
bfredl commented 8 years ago

Hmm _screen is not created until _nvim_resize. @tarruda could it be that initialization is racy so some other event gets processed before the first resize event ?

leonardinius commented 8 years ago

I recall same/similar behavior with py3 for some time actually (at least 3-6 months); if it helps.

tarruda commented 8 years ago

@tarruda could it be that initialization is racy so some other event gets processed before the first resize event ?

I think it's more probable that some other error could be interrupting _nvim_resize. Don't see how the resize notification could be missed since it is always sent after ui_attach.

In any case I have no idea what could be wrong. I just tested neovim-gui using both pip and pip3 and everything worked as expected(no issues with the missing pynvim alias).

@leonardinius does it help if you update both neovim and neovim-gui packages?

pip install --upgrade neovim
pip install --upgrade neovim-gui
leonardinius commented 8 years ago

It's the first think I've tried.

My local setup:

py2 - works for gui; pynvim shell script absent; py3 - as described above.

Hope it helps.

leonardinius commented 8 years ago

stuff it spews while installing pip3 neovim-gui

Downloading/unpacking neovim-gui
  Downloading neovim_gui-0.1.1.tar.gz
  Running setup.py (path:/tmp/pip-build-yrwak539/neovim-gui/setup.py) egg_info for package neovim-gui

Requirement already up-to-date: neovim>=0.1.3 in /usr/local/lib/python3.4/dist-packages (from neovim-gui)
Downloading/unpacking click>=3.0 (from neovim-gui)
Requirement already up-to-date: pygobject in /usr/lib/python3/dist-packages (from neovim-gui)
Downloading/unpacking msgpack-python>=0.4.0 (from neovim>=0.1.3->neovim-gui)
  Running setup.py (path:/tmp/pip-build-yrwak539/msgpack-python/setup.py) egg_info for package msgpack-python

Downloading/unpacking greenlet (from neovim>=0.1.3->neovim-gui)
  Running setup.py (path:/tmp/pip-build-yrwak539/greenlet/setup.py) egg_info for package greenlet

Installing collected packages: neovim-gui, click, msgpack-python, greenlet
  Running setup.py install for neovim-gui

    Installing pynvim script to /usr/local/bin
  Running setup.py install for msgpack-python
    building 'msgpack._packer' extension
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fPIC -D__LITTLE_ENDIAN__=1 -I. -I/usr/include/python3.4m -c msgpack/_packer.cpp -o build/temp.linux-x86_64-3.4/msgpack/_packer.o
    cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
    x86_64-linux-gnu-g++ -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 build/temp.linux-x86_64-3.4/msgpack/_packer.o -o build/lib.linux-x86_64-3.4/msgpack/_packer.cpython-34m.so
    building 'msgpack._unpacker' extension
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fPIC -D__LITTLE_ENDIAN__=1 -I. -I/usr/include/python3.4m -c msgpack/_unpacker.cpp -o build/temp.linux-x86_64-3.4/msgpack/_unpacker.o
    cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
    x86_64-linux-gnu-g++ -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 build/temp.linux-x86_64-3.4/msgpack/_unpacker.o -o build/lib.linux-x86_64-3.4/msgpack/_unpacker.cpython-34m.so

  Running setup.py install for greenlet
    building 'greenlet' extension
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.4m -c greenlet.c -o build/temp.linux-x86_64-3.4/greenlet.o
    x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 build/temp.linux-x86_64-3.4/greenlet.o -o build/lib.linux-x86_64-3.4/greenlet.cpython-34m.so

Successfully installed neovim-gui click msgpack-python greenlet
Cleaning up...
leonardinius commented 8 years ago

should I split the issue into two separate issues:

??

tarruda commented 8 years ago

@leonardinius I don't know why you have this problem. I tested on a fresh ubuntu 15.10 and it worked flawless, so I imagine there could be some issues with your setup.

Any chance you have leftovers of virtualenv/pyenv and the pip command is targeting one of these environments? What's the output of which {pip,pip3,python,python3}?

leonardinius commented 8 years ago
 which {pip,pip3,python,python3}
/usr/bin/pip
/usr/bin/pip3
/usr/bin/python
/usr/bin/python3
Shougo commented 8 years ago

@leonardinius I have tested it in Ubuntu 14.04.

pynvim command absent with py2

No. But it is overwritten if you installed neovim-python in python3.

For example:

  1. install neovim-python in Python2 -> pynvim is Python2
  2. install neovim-python in Python3 -> pynvim is Python3

gui does not work with py3

It seems work. But it is not auto resized by Window size. Manual resizing (change &columns and &lines values manually) works. I think it is bug.

timeyyy commented 8 years ago

I think it's more probable that some other error could be interrupting _nvim_resize. Don't see how the resize notification could be missed since it is always sent after ui_attach.

so in summary:

AttributeError: 'NoneType' object has no attribute 'row'

is a side effect of another exception being raised

I have only tested on python3.4

pynvim

gives the following

Exception ignored in: <bound method _UnixSubprocessTransport.__del__ of <_UnixSubprocessTransport pid=21612 stdin=<_UnixWritePipeTransport closed fd=8 closed> stdout=<_UnixReadPipeTransport closed fd=9 closed> stderr=<_UnixReadPipeTransport closed fd=11 closed>>>
Traceback (most recent call last):
  File "/usr/lib/python3.4/asyncio/base_subprocess.py", line 113, in __del__
TypeError: 'NoneType' object is not callable

or sometimes

Exception ignored in: <bound method _UnixSubprocessTransport.__del__ of <_UnixSubprocessTransport pid=21612 stdin=<_UnixWritePipeTransport closed fd=8 closed> stdout=<_UnixReadPipeTransport closed fd=9 closed> stderr=<_UnixReadPipeTransport closed fd=11 closed>>>
Traceback (most recent call last):
  File "/usr/lib/python3.4/asyncio/base_subprocess.py", line 113, in __del__
TypeError: 'NoneType' object is not callable

I am using the same bridge and screen code for pytknvim and the same errors are happening there as well.

leonardinius commented 8 years ago

I tried it recently in ubuntu 16 (through upgrade) and it wprked as expected.

Closing as obsolete