Skip to content

OSError: EOF when trying to run example code on Windows #505

Closed
@Toqozz

Description

@Toqozz

I'm trying to run the example code on the main page of the README, namely:

>>> from pynvim import attach
>>> nvim = attach('child', argv=["/bin/env", "nvim", "--embed", "--headless"])

But I get an error instead:

>>> from pynvim import attach
>>> nvim = attach('child', argv=['C:\\Users\\Toqoz\\Documents\\code\\neovim-test\\Neovim2\\bin\\nvim.exe', '--embed', '--headless'])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\Toqoz\AppData\Roaming\Python\Python39\site-packages\pynvim\__init__.py", line 122, in attach
    return Nvim.from_session(session).with_decode(decode)
  File "C:\Users\Toqoz\AppData\Roaming\Python\Python39\site-packages\pynvim\api\nvim.py", line 80, in from_session
    channel_id, metadata = session.request(b'nvim_get_api_info')
  File "C:\Users\Toqoz\AppData\Roaming\Python\Python39\site-packages\pynvim\msgpack_rpc\session.py", line 98, in request
    raise OSError('EOF')
OSError: EOF

Running the same thing from a script gives a bit more info, but I think it's irrelevant:

Traceback (most recent call last):
  File "C:\Users\Toqoz\Documents\code\neovim-test\something.py", line 4, in <module>
    nvim = attach('child', argv=['C:\\Users\\Toqoz\\Documents\\code\\neovim-test\\Neovim2\\bin\\nvim.exe', "--embed"])
  File "C:\Users\Toqoz\AppData\Roaming\Python\Python39\site-packages\pynvim\__init__.py", line 122, in attach
    return Nvim.from_session(session).with_decode(decode)
  File "C:\Users\Toqoz\AppData\Roaming\Python\Python39\site-packages\pynvim\api\nvim.py", line 80, in from_session
    channel_id, metadata = session.request(b'nvim_get_api_info')
  File "C:\Users\Toqoz\AppData\Roaming\Python\Python39\site-packages\pynvim\msgpack_rpc\session.py", line 98, in request
    raise OSError('EOF')
OSError: EOF
Exception ignored in: <function BaseSubprocessTransport.__del__ at 0x00000254C7607D30>
Traceback (most recent call last):
  File "C:\Users\Toqoz\AppData\Local\Programs\Python\Python39\lib\asyncio\base_subprocess.py", line 126, in __del__
  File "C:\Users\Toqoz\AppData\Local\Programs\Python\Python39\lib\asyncio\base_subprocess.py", line 104, in close
  File "C:\Users\Toqoz\AppData\Local\Programs\Python\Python39\lib\asyncio\proactor_events.py", line 108, in close
  File "C:\Users\Toqoz\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 746, in call_soon
  File "C:\Users\Toqoz\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 510, in _check_closed
RuntimeError: Event loop is closed
Exception ignored in: <function _ProactorBasePipeTransport.__del__ at 0x00000254C7637670>
Traceback (most recent call last):
  File "C:\Users\Toqoz\AppData\Local\Programs\Python\Python39\lib\asyncio\proactor_events.py", line 115, in __del__
  File "C:\Users\Toqoz\AppData\Local\Programs\Python\Python39\lib\asyncio\proactor_events.py", line 79, in __repr__
  File "C:\Users\Toqoz\AppData\Local\Programs\Python\Python39\lib\asyncio\windows_utils.py", line 102, in fileno
ValueError: I/O operation on closed pipe

Any pointers? I've also tried connecting using a socket but that also behaves weirdly on Windows.

$ python -- version
Python 3.9.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions