rkitover / vimpager

Use Vim as PAGER
http://www.vim.org/scripts/script.php?script_id=1723
Other
772 stars 72 forks source link

vimpager and ipython/jupyter cause kernel to hang #145

Open ocehugo opened 8 years ago

ocehugo commented 8 years ago

Hi @rkitover,

it seems that vimpager is not as compatible as other pages for ipython/jupyter. I found this annoying bug using vimpager as the ipython pager through c.TerminalInteractiveShell.pager = 'vimpager'.

For the help funcitons it works, but it seems that for debugging (%pdb) it cause the kernel of ipython to hang.

To reproduce you can run the jupyter console code below with the option above in the default profile of ipython/jupyter:

jupyter console
In [1]: x=10
In [2]: %pdb
Automatic pdb calling has been turned ON
In [3]: x.error()
rkitover commented 8 years ago

@ocehugo I tried this, and it just spits out two attribute errors for me, is there some option that controls invoking the pager?

ocehugo commented 8 years ago

Humm...did you tried calling the x.error() again after that? I found out that (maybe related to ipython internals) sometimes it works the first time (returning an AttributeError as expected and opening the debugger dialog) , but soon after quitting the debug and getting other exceptions the kernel hangs trying to comunicate/show with the pager.

Also note that you need to be running inside a kernel, not plain ipython.

rkitover commented 8 years ago

This is what I see:

screenshot

rkitover commented 8 years ago

@ocehugo Maybe you can give me something that generates a longer exception stack?

rkitover commented 8 years ago

@ocehugo also, what OS are you on, are you using master and have a recent vim?

ocehugo commented 8 years ago

OSX El Capitain

VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Feb 29 2016 10:35:10) MacOS X (unix) version Included patches: 1-1453

jupyter-console 4.4.1

Sorry, assumed you were used to ipython.

How to reproduce:

include c.TerminalInteractiveShell.pager = 'vimpager'``` in the ipython profile:

echo "c.TerminalInteractiveShell.pager = 'vimpager'" >> ~/.ipython/profile_default/ipython_config.py

and after that call jupyter:

jupyter console
%pdb  
x=10 
x.error()
ipdb>q 
x.error()

call jupyter, enable the debugger (pdb), set x raise error (should hang here) quit the debuggeer dialog (should hang here after quiting sometimes) raise the error again (should hang)

To me looks like it's a OS related, since it should hang after you call x.error() . the ipdb> dialog is the debugger. To test further you could, after the dialog is open call q (to quit) and call x.error() again to test further ( as I said before, sometimes it works first time, but soon after quiting the debugger the kernel hangs).

rkitover commented 8 years ago

I put that into ~/.jupyter/jupyter_console_config.py and it does not make a difference. I am also on El Cap.

rkitover commented 8 years ago

BTW, if you are using vimpager from homebrw, please try master instead.

ocehugo commented 8 years ago

That is really strange, because i can make the kernel hangs if using the option and without it it works.

I can't install vimpager HEAD through brew :

→ brew install vimpager --HEAD
==> Cloning https://github.com/rkitover/vimpager.git
Updating /Library/Caches/Homebrew/vimpager--git
==> Checking out branch master
Error: No such file or directory - vimcat.md
rkitover commented 8 years ago

The formula is outdated, I just made a tap, use this:

brew tap rkitover/vimpager git://github.com/rkitover/vimpager.git
brew reinstall rkitover/vimpager/vimpager --HEAD
ocehugo commented 8 years ago

updated and keep happening... I will leave it as is, since it's not as important (the functionality doesnt change in using less inside the ipython console). I simple put vimpager there in the configuration and using it caused a lot of unexpected problems.

PS: I noted that now with your tap vimpager is much more slower than with the older on.

rkitover commented 8 years ago

Yeah I'm in the middle of a major refactor, I'll have to look at the speed issues.

In any case, since I can't reproduce your issue I don't know what the problem is, unless you can find some other way to reproduce it.