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

Python REPL error #280

Closed
strboul opened this issue Apr 19, 2020 · 8 comments
Closed

Python REPL error #280

strboul opened this issue Apr 19, 2020 · 8 comments
Labels

Comments

@strboul
Copy link
Contributor

strboul commented Apr 19, 2020

Describe the bug
Get an error when using :TREPLSendLine from a Python file:

Error detected while processing function neoterm#repl#line[2]..316[4]..neoterm#repl#python#exec[11]..278
[4]..283:
line    1:
E900: Invalid channel id
Press ENTER or type command to continue

Most likely, the bug is introduced in this PR #273

Versions (please complete the following information):

  • OS: macOS
  • neoterm commit sha1 c59657b
  • NVIM v0.4.3
@strboul strboul added the bug label Apr 19, 2020
@kassio
Copy link
Owner

kassio commented Apr 19, 2020

@strboul can you give an example, please?
Do you have a custom g:neoterm_repl_python?

@strboul
Copy link
Contributor Author

strboul commented Apr 19, 2020

I don't have a custom g:neoterm_repl_python option. Here's the neoterm related config in my init.vim:

let g:neoterm_default_mod="belowright"
let g:neoterm_size=16
let g:neoterm_autoscroll=1
let g:neoterm_direct_open_repl=1
" Calling :Tclose or :Ttoggle kills the terminal
let g:neoterm_keep_term_open=0
" Set REPLs
if executable("radian")
  let g:neoterm_repl_r="radian"
endif
" send current line and move down
nnoremap <silent><leader><cr> :TREPLSendLine<cr>j
" send current selection
" ('> goes to the last selected Visual area in the current buffer)
vnoremap <silent><leader><cr> :TREPLSendSelection<cr>'>j
" toggle terminal
nnoremap <silent><c-t><c-t> :Ttoggle<CR>
tnoremap <silent><c-t><c-t> <C-\><C-n>:Ttoggle<CR>

@kassio
Copy link
Owner

kassio commented Apr 19, 2020

I'm not a python dev, the simple hello world worked on my machine. Can you give me a longer piece of code for tests, please?

@strboul
Copy link
Contributor Author

strboul commented Apr 19, 2020

I cannot start a python REPL (via :Tnew or :Ttoggle) from any file ending with .py; instead, it creates an empty buffer. Maybe neoterm cannot find the python in my paths?

command -v python3
# /usr/local/bin/python3
command -v python
# /usr/bin/python
command -v ipython3
# /usr/local/bin/ipython3
command -v ipython
# /usr/local/bin/ipython

Edit: No luck when I add the let g:neoterm_repl_python="ipython3" line to my init.vim.

Edit2: The problem is only with the Python REPL. Other REPLs are working.

@incoggnito
Copy link
Contributor

incoggnito commented Apr 21, 2020

Never used the direct_open_repl setting, but I can reproduce the error.
I will try to fix this.

Edit: The error has apparently occurred with commit f6c6ce0Y. I'll take a closer look at that tomorrow.

Edit2:

function! s:vim.new(opts)
  let l:opts = {
        ...
        \ }
  if g:neoterm_direct_open_repl
    return term_start(g:neoterm_repl_command, l:opts) "<-- HERE: g:neoterm_repl_command[0]
  else
    return term_start(g:neoterm_shell, l:opts)
  end
endfunction

Since the variable g: neoterm_repl_command has changed from a string to a list, I thought that g: neoterm_repl_command[0] would solve the problem. Yeah, it does not ...
I would like to find out which values are hidden behind l:opts and how term_start() works.
I have set a breakpoint within the function. With :debug Tnew I would have expected a stop at the breakpoint. But the function does not seem to be executed at all. I'm trying to understand the execution chain, but I'm still struggling with the debugger. @kassio, can you help?

@BlueDrink9
Copy link

BlueDrink9 commented Apr 23, 2020

I'm having this issue all of a sudden as well. Fixed by reverting to e011fa1

@incoggnito
Copy link
Contributor

Oh man I actually already had the bug ... I just didn't notice that there is both a term#vim and a term#neovim. I will open a pull request.

@kassio
Copy link
Owner

kassio commented Apr 29, 2020

It should be fixed now, let me know if you have any other problem.

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

No branches or pull requests

4 participants