neovim / pynvim

Python client and plugin host for Nvim
http://pynvim.readthedocs.io/en/latest/
Apache License 2.0
1.52k stars 118 forks source link

AttributeError: 'Host' object has no attribute 'name' in _on_error_event #425

Closed blueyed closed 4 years ago

blueyed commented 4 years ago

I've just seen this:

error caught in notification handler 'b'nvim_error_event' [0, b'Vim(sign):E158: Invalid buffer name: 12']'
Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/pynvim/plugin/host.py", line 139, in _on_notification
    handler(*args)
  File "/usr/lib/python3.8/site-packages/pynvim/plugin/host.py", line 60, in _on_error_event
    self.name, decode_if_bytes(msg))
AttributeError: 'Host' object has no attribute 'name'

python-pynvim 0.4.0-1

Code: https://github.com/neovim/python-client/blob/4949d43cd45da16c184a15b3f14ebb1f097e8e94/pynvim/plugin/host.py#L56-L61

blueyed commented 4 years ago

For reference: initially done in 408025b6, refactored in https://github.com/neovim/pynvim/commit/6310063#diff-b891d59af469be1dc12f5f57b03a2581L166, but should be set via get_client_info` (https://github.com/blueyed/python-client/blob/4949d43cd45da16c184a15b3f14ebb1f097e8e94/pynvim/util.py#L39).

justinmk commented 4 years ago

I guess that self.name = name is needed in _load. Or (seems more likely) _on_error_event should get the client name a different way, instead of expecting that attribute on the host object.

https://github.com/neovim/pynvim/pull/426