Skip to content

Cannot execute a vim command from a new asyncio task #342

Open
@tbodt

Description

@tbodt

To reproduce: Start Neovim with NVIM_PYTHON_LOG_FILE set, and run these commands:

py3 async def foo(): vim.out_write('testing')
py3 import asyncio, vim; asyncio.ensure_future(foo())

Then look in the python log file (_script suffix) and see:

2018-06-30 20:20:29,362 [ERROR @ base_events.py:default_exception_handler:1266] 31555 - Task exception was never retrieved
future: <Task finished coro=<foo() done, defined at <string>:1> exception=AttributeError("'NoneType' object has no attribute 'switch'",)>
Traceback (most recent call last):
  File "<string>", line 1, in foo
  File "/usr/local/lib/python3.6/site-packages/neovim/api/nvim.py", line 378, in out_write
    return self.request('nvim_out_write', msg, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/neovim/api/nvim.py", line 170, in request
    res = self._session.request(name, *args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/neovim/msgpack_rpc/session.py", line 91, in request
    v = self._yielding_request(method, args)
  File "/usr/local/lib/python3.6/site-packages/neovim/msgpack_rpc/session.py", line 160, in _yielding_request
    return parent.switch()
AttributeError: 'NoneType' object has no attribute 'switch'

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions