Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pythoni, pythoni1 and nvim checkhealth #47

Open
rachmadaniHaryono opened this issue Nov 22, 2021 · 0 comments
Open

pythoni, pythoni1 and nvim checkhealth #47

rachmadaniHaryono opened this issue Nov 22, 2021 · 0 comments

Comments

@rachmadaniHaryono
Copy link

Subject of the issue

when running nvim checkhealth, pythoni and pythoni1 raise AttributeError

Your environment

  • python 3.9.7
  • nvim v0.5.1
  • pyrepl 0.8.5.dev52+gf1e5513

Steps to reproduce

  1. on empty folder create following pyproject.toml
pyproject.toml

[tool.poetry]
name = "temp"
version = "0.1.0"
description = ""
authors = ["author <[email protected]>"]

[tool.poetry.dependencies]
python = "^3.9"
pyrepl = {git = "https://github.com/pypy/pyrepl.git"}

[tool.poetry.dev-dependencies]

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

  1. run poetry install
  2. run poetry run nvim -c checkhealth

Expected behaviour

there is no error on python virtualenv section

## Python virtualenv
  - INFO: $VIRTUAL_ENV is set to: /home/r3r/.cache/pypoetry/virtualenvs/pyrepl-p7QPvHdF-py3.9
  - INFO: Python version: 3.9.7
  - OK: $VIRTUAL_ENV provides :!python.

Actual behaviour

## Python virtualenv
  - WARNING: $VIRTUAL_ENV is set to: /home/r3r/.cache/pypoetry/virtualenvs/temp--3d1chu2-py3.9
    And its /bin directory contains: python, python3, python3.9, pythoni, pythoni1
    But $PATH yields this pythoni executable: Python 3.9.7 (default, Sep 10 2021, 14:59:43) 
    [GCC 11.2.0] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    Traceback (most recent call last):
    File "/home/r3r/.cache/pypoetry/virtualenvs/temp--3d1chu2-py3.9/lib/python3.9/site-packages/pyrepl/reader.py", line 482, in prepare
    self.console.prepare()
    File "/home/r3r/.cache/pypoetry/virtualenvs/temp--3d1chu2-py3.9/lib/python3.9/site-packages/pyrepl/unix_console.py", line 357, in prepare
    self.__svtermstate = tcgetattr(self.input_fd)
    File "/home/r3r/.cache/pypoetry/virtualenvs/temp--3d1chu2-py3.9/lib/python3.9/site-packages/pyrepl/fancy_termios.py", line 34, in tcgetattr
    return TermState(termios.tcgetattr(fd))
    termios.error: (25, 'Inappropriate ioctl for device')
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
    File "/home/r3r/.cache/pypoetry/virtualenvs/temp--3d1chu2-py3.9/bin/pythoni", line 36, in <module>
    main(use_pygame_console=('pg' in sys.argv))
    File "/home/r3r/.cache/pypoetry/virtualenvs/temp--3d1chu2-py3.9/lib/python3.9/site-packages/pyrepl/python_reader.py", line 403, in main
    getattr(rc, interactmethod)()
    File "/home/r3r/.cache/pypoetry/virtualenvs/temp--3d1chu2-py3.9/lib/python3.9/site-packages/pyrepl/python_reader.py", line 207, in interact
    l = unicode(self.reader.readline(), 'utf-8')
    File "/home/r3r/.cache/pypoetry/virtualenvs/temp--3d1chu2-py3.9/lib/python3.9/site-packages/pyrepl/reader.py", line 599, in readline
    self.prepare()
    File "/home/r3r/.cache/pypoetry/virtualenvs/temp--3d1chu2-py3.9/lib/python3.9/site-packages/pyrepl/historical_reader.py", line 240, in prepare
    super(HistoricalReader, self).prepare()
    File "/home/r3r/.cache/pypoetry/virtualenvs/temp--3d1chu2-py3.9/lib/python3.9/site-packages/pyrepl/reader.py", line 492, in prepare
    self.restore()
    File "/home/r3r/.cache/pypoetry/virtualenvs/temp--3d1chu2-py3.9/lib/python3.9/site-packages/pyrepl/reader.py", line 502, in restore
    self.console.restore()
    File "/home/r3r/.cache/pypoetry/virtualenvs/temp--3d1chu2-py3.9/lib/python3.9/site-packages/pyrepl/unix_console.py", line 389, in restore
    self.__maybe_write_code(self._rmkx)
    File "/home/r3r/.cache/pypoetry/virtualenvs/temp--3d1chu2-py3.9/lib/python3.9/site-packages/pyrepl/unix_console.py", line 305, in __maybe_write_code
    self.__write_code(fmt, *args)
    File "/home/r3r/.cache/pypoetry/virtualenvs/temp--3d1chu2-py3.9/lib/python3.9/site-packages/pyrepl/unix_console.py", line 301, in __write_code
    self.__buffer.append((curses.tparm(fmt, *args), 1))
    AttributeError: 'UnixConsole' object has no attribute '_UnixConsole__buffer'
    
    And $PATH in subshells yields this pythoni executable: Python 3.9.7 (default, Sep 10 2021, 14:59:43) 
    [GCC 11.2.0] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    Traceback (most recent call last):
    File "/home/r3r/.cache/pypoetry/virtualenvs/temp--3d1chu2-py3.9/lib/python3.9/site-packages/pyrepl/reader.py", line 482, in prepare
    self.console.prepare()
    File "/home/r3r/.cache/pypoetry/virtualenvs/temp--3d1chu2-py3.9/lib/python3.9/site-packages/pyrepl/unix_console.py", line 357, in prepare
    self.__svtermstate = tcgetattr(self.input_fd)
    File "/home/r3r/.cache/pypoetry/virtualenvs/temp--3d1chu2-py3.9/lib/python3.9/site-packages/pyrepl/fancy_termios.py", line 34, in tcgetattr
    return TermState(termios.tcgetattr(fd))
    termios.error: (25, 'Inappropriate ioctl for device')
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
    File "/home/r3r/.cache/pypoetry/virtualenvs/temp--3d1chu2-py3.9/bin/pythoni", line 36, in <module>
    main(use_pygame_console=('pg' in sys.argv))
    File "/home/r3r/.cache/pypoetry/virtualenvs/temp--3d1chu2-py3.9/lib/python3.9/site-packages/pyrepl/python_reader.py", line 403, in main
    getattr(rc, interactmethod)()
    File "/home/r3r/.cache/pypoetry/virtualenvs/temp--3d1chu2-py3.9/lib/python3.9/site-packages/pyrepl/python_reader.py", line 207, in interact
    l = unicode(self.reader.readline(), 'utf-8')
    File "/home/r3r/.cache/pypoetry/virtualenvs/temp--3d1chu2-py3.9/lib/python3.9/site-packages/pyrepl/reader.py", line 599, in readline
    self.prepare()
    File "/home/r3r/.cache/pypoetry/virtualenvs/temp--3d1chu2-py3.9/lib/python3.9/site-packages/pyrepl/historical_reader.py", line 240, in prepare
    super(HistoricalReader, self).prepare()
    File "/home/r3r/.cache/pypoetry/virtualenvs/temp--3d1chu2-py3.9/lib/python3.9/site-packages/pyrepl/reader.py", line 492, in prepare
    self.restore()
    File "/home/r3r/.cache/pypoetry/virtualenvs/temp--3d1chu2-py3.9/lib/python3.9/site-packages/pyrepl/reader.py", line 502, in restore
    self.console.restore()
    File "/home/r3r/.cache/pypoetry/virtualenvs/temp--3d1chu2-py3.9/lib/python3.9/site-packages/pyrepl/unix_console.py", line 389, in restore
    self.__maybe_write_code(self._rmkx)
    File "/home/r3r/.cache/pypoetry/virtualenvs/temp--3d1chu2-py3.9/lib/python3.9/site-packages/pyrepl/unix_console.py", line 305, in __maybe_write_code
    self.__write_code(fmt, *args)
    File "/home/r3r/.cache/pypoetry/virtualenvs/temp--3d1chu2-py3.9/lib/python3.9/site-packages/pyrepl/unix_console.py", line 301, in __write_code
    self.__buffer.append((curses.tparm(fmt, *args), 1))
    AttributeError: 'UnixConsole' object has no attribute '_UnixConsole__buffer'
    
    And $PATH yields this pythoni1 executable: Python 3.9.7 (default, Sep 10 2021, 14:59:43) 
    [GCC 11.2.0]
    Traceback (most recent call last):
    File "/home/r3r/.cache/pypoetry/virtualenvs/temp--3d1chu2-py3.9/lib/python3.9/site-packages/pyrepl/reader.py", line 482, in prepare
    self.console.prepare()
    File "/home/r3r/.cache/pypoetry/virtualenvs/temp--3d1chu2-py3.9/lib/python3.9/site-packages/pyrepl/unix_console.py", line 357, in prepare
    self.__svtermstate = tcgetattr(self.input_fd)
    File "/home/r3r/.cache/pypoetry/virtualenvs/temp--3d1chu2-py3.9/lib/python3.9/site-packages/pyrepl/fancy_termios.py", line 34, in tcgetattr
    return TermState(termios.tcgetattr(fd))
    termios.error: (25, 'Inappropriate ioctl for device')
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
    File "/home/r3r/.cache/pypoetry/virtualenvs/temp--3d1chu2-py3.9/bin/pythoni1", line 19, in <module>
    run_multiline_interactive_console()
    File "/home/r3r/.cache/pypoetry/virtualenvs/temp--3d1chu2-py3.9/lib/python3.9/site-packages/pyrepl/simple_interact.py", line 64, in run_multiline_interactive_console
    statement = multiline_input(more_lines, ps1, ps2,
    File "/home/r3r/.cache/pypoetry/virtualenvs/temp--3d1chu2-py3.9/lib/python3.9/site-packages/pyrepl/readline.py", line 248, in multiline_input
    return reader.readline(returns_unicode=returns_unicode)
    File "/home/r3r/.cache/pypoetry/virtualenvs/temp--3d1chu2-py3.9/lib/python3.9/site-packages/pyrepl/reader.py", line 599, in readline
    self.prepare()
    File "/home/r3r/.cache/pypoetry/virtualenvs/temp--3d1chu2-py3.9/lib/python3.9/site-packages/pyrepl/historical_reader.py", line 240, in prepare
    super(HistoricalReader, self).prepare()
    File "/home/r3r/.cache/pypoetry/virtualenvs/temp--3d1chu2-py3.9/lib/python3.9/site-packages/pyrepl/reader.py", line 492, in prepare
    self.restore()
    File "/home/r3r/.cache/pypoetry/virtualenvs/temp--3d1chu2-py3.9/lib/python3.9/site-packages/pyrepl/reader.py", line 502, in restore
    self.console.restore()
    File "/home/r3r/.cache/pypoetry/virtualenvs/temp--3d1chu2-py3.9/lib/python3.9/site-packages/pyrepl/unix_console.py", line 389, in restore
    self.__maybe_write_code(self._rmkx)
    File "/home/r3r/.cache/pypoetry/virtualenvs/temp--3d1chu2-py3.9/lib/python3.9/site-packages/pyrepl/unix_console.py", line 305, in __maybe_write_code
    self.__write_code(fmt, *args)
    File "/home/r3r/.cache/pypoetry/virtualenvs/temp--3d1chu2-py3.9/lib/python3.9/site-packages/pyrepl/unix_console.py", line 301, in __write_code
    self.__buffer.append((curses.tparm(fmt, *args), 1))
    AttributeError: 'UnixConsole' object has no attribute '_UnixConsole__buffer'
    
    And $PATH in subshells yields this pythoni1 executable: Python 3.9.7 (default, Sep 10 2021, 14:59:43) 
    [GCC 11.2.0]
    Traceback (most recent call last):
    File "/home/r3r/.cache/pypoetry/virtualenvs/temp--3d1chu2-py3.9/lib/python3.9/site-packages/pyrepl/reader.py", line 482, in prepare
    self.console.prepare()
    File "/home/r3r/.cache/pypoetry/virtualenvs/temp--3d1chu2-py3.9/lib/python3.9/site-packages/pyrepl/unix_console.py", line 357, in prepare
    self.__svtermstate = tcgetattr(self.input_fd)
    File "/home/r3r/.cache/pypoetry/virtualenvs/temp--3d1chu2-py3.9/lib/python3.9/site-packages/pyrepl/fancy_termios.py", line 34, in tcgetattr
    return TermState(termios.tcgetattr(fd))
    termios.error: (25, 'Inappropriate ioctl for device')
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
    File "/home/r3r/.cache/pypoetry/virtualenvs/temp--3d1chu2-py3.9/bin/pythoni1", line 19, in <module>
    run_multiline_interactive_console()
    File "/home/r3r/.cache/pypoetry/virtualenvs/temp--3d1chu2-py3.9/lib/python3.9/site-packages/pyrepl/simple_interact.py", line 64, in run_multiline_interactive_console
    statement = multiline_input(more_lines, ps1, ps2,
    File "/home/r3r/.cache/pypoetry/virtualenvs/temp--3d1chu2-py3.9/lib/python3.9/site-packages/pyrepl/readline.py", line 248, in multiline_input
    return reader.readline(returns_unicode=returns_unicode)
    File "/home/r3r/.cache/pypoetry/virtualenvs/temp--3d1chu2-py3.9/lib/python3.9/site-packages/pyrepl/reader.py", line 599, in readline
    self.prepare()
    File "/home/r3r/.cache/pypoetry/virtualenvs/temp--3d1chu2-py3.9/lib/python3.9/site-packages/pyrepl/historical_reader.py", line 240, in prepare
    super(HistoricalReader, self).prepare()
    File "/home/r3r/.cache/pypoetry/virtualenvs/temp--3d1chu2-py3.9/lib/python3.9/site-packages/pyrepl/reader.py", line 492, in prepare
    self.restore()
    File "/home/r3r/.cache/pypoetry/virtualenvs/temp--3d1chu2-py3.9/lib/python3.9/site-packages/pyrepl/reader.py", line 502, in restore
    self.console.restore()
    File "/home/r3r/.cache/pypoetry/virtualenvs/temp--3d1chu2-py3.9/lib/python3.9/site-packages/pyrepl/unix_console.py", line 389, in restore
    self.__maybe_write_code(self._rmkx)
    File "/home/r3r/.cache/pypoetry/virtualenvs/temp--3d1chu2-py3.9/lib/python3.9/site-packages/pyrepl/unix_console.py", line 305, in __maybe_write_code
    self.__write_code(fmt, *args)
    File "/home/r3r/.cache/pypoetry/virtualenvs/temp--3d1chu2-py3.9/lib/python3.9/site-packages/pyrepl/unix_console.py", line 301, in __write_code
    self.__buffer.append((curses.tparm(fmt, *args), 1))
    AttributeError: 'UnixConsole' object has no attribute '_UnixConsole__buffer'
    
    So invoking Python may lead to unexpected results.
    - ADVICE:
      - $PATH ambiguities arise if the virtualenv is not properly activated prior to launching Nvim. Close Nvim, activate the virtualenv, check that invoking Python from the command line launches the correct one, then relaunch Nvim.
      - $PATH ambiguities in subshells typically are caused by your shell config overriding the $PATH previously set by the virtualenv. Either prevent them from doing so, or use this workaround: https://vi.stackexchange.com/a/7654

Comment

this could probably nvim issue, but i don't know how to repoduce it without nvim checkhealth

there is also neovim/neovim#13965 which may not detect pythoni and pythoni1 in future version of nvim

related issue pdbpp/pdbpp#476

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant