szymonmaszke / vimpyter

Edit your Jupyter notebooks in Vim/Neovim
MIT License
334 stars 17 forks source link

Undefined variable: b:original_file #9

Closed Palpatineli closed 6 years ago

Palpatineli commented 6 years ago

Invalid arguments for jobstart. I get this error when I try to open jupyter from within a ipynb file on neovim 0.2.2, jupyter 4.4.0 and most recent vimpyter. I have notedown 1.5.1 installed. What could be the problem? How do I get debug info for vimpyter? Thanks for this very promising project.

szymonmaszke commented 6 years ago

Need more informations regarding the file itself, it's name, other open buffers, path to it. Is the file converted correctly and you can see .ipynb source in you neovim? What does :call vimpyter#getOriginalFile() return?

Palpatineli commented 6 years ago

I created it with jupyter notebook from chrome. It has just one cell with import numpy and create one random array, and is named "temp.ipynb". I can see the ipynb souce in neovim. When I call vimpyter#getOriginalFile() I get E121: undefined variable: b:original_file and E15: invalid expression: 'Proxy points to' . b:original_file

szymonmaszke commented 6 years ago

That is a strange way to use this plugin really... You should just create temp.ipynb, call function :VimpyterInsertPythonBlock and write your code over there.

Anyway I'll look into it this weekend, thanks for reporting.

szymonmaszke commented 6 years ago

Improved buffer/view creation, does it work now?

Palpatineli commented 6 years ago

​Thanks for the update! ​Unfortunately when I just ​tried that ​, it gave me this error:

Error detected while processing function vimpyter#updateNotebook[41]..117_updateNotebookNeovim: line 11: E121: Undefined variable: b:proxy_file E116: Invalid arguments for function jobstart E15: Invalid expression: jobstart( 'notedown --from markdown --to notebook ' . b:proxy_file . ' > ' . b:original_file, { 'on_exit': function('s:updateSuccessNeovim') }) Executing BufWritePost Auto commands for "*"

​At lea ​s​ t it's not complaining about b:origi ​nal_file, I guess.​ ​ ​ ​ ​ ​


Best, Keji Li

kejili@mit.edu (primary) mail@keji.li (backup) (615)818-7103

On Fri, Mar 30, 2018 at 5:40 PM, Szymon Maszke notifications@github.com wrote:

Improved buffer/view creation, does it work now?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/vyzyv/vimpyter/issues/9#issuecomment-377629542, or mute the thread https://github.com/notifications/unsubscribe-auth/AANrQXAJ10Qov_DUe1hkDhOCyfn0rq9lks5tjqZCgaJpZM4SyhI- .

szymonmaszke commented 6 years ago

Just created notebook inside jupyter notebook app (Vivaldi browser), saved it to temp.ipynb in my $HOME directory and opened forementioned file with neovim. Everything works correctly. Could you provide the steps to reproduce the issue if I've done it incorrectly?

Could you check whether this error appears using minimal .vimrc/init.vim (only this plugin and it's dependencies installed)?

Palpatineli commented 6 years ago

I just tried a minimal .vimrc and it seemed to be working. I'll need to hunt down the offending plugin now. Thanks for the fix! plz close the issue.

lesguillemets commented 6 years ago

I had the same issue. Although it might not be related, for me the lazy loading feature that some plugin managers have was to blame.

I had the same errors as described above when I configured this plugin to be loaded only for files *.ipynb or when commands defined by this plugin is called. Either disabling the lazy loading for it or reloading the ipynb file (just :ed %) fixed the problem for me. I'll look into it further when I have the time.

naefl commented 5 years ago

@lesguillemets Did you further look into this? How did you disable lazy loading?

For me the .ipynb displays as normal JSON until I hit :ed %, then it loads correctly. Any ideas? Happy to open a new issue if not related @szymonmaszke

szymonmaszke commented 5 years ago

@naefi this plugin lazy loads by default. What plugin manager are you using? What OS, other information and small reproducible .vimrc?

lesguillemets commented 5 years ago

@naefl @szymonmaszke Sorry, I haven't looked further. Let me clarify a bit; this plugin lazy loads by default (by utilising the autoload mechanism of vim) and it works just fine. Some plugin managers have another option to lazy load the plugin entirely (basically by delaying the modification of rtp), and this seems to conflict with the plugin. Configuring the plugin manager to always load this plugin (so that it'll lazy load itself) would be a viable fix without too much drawback, and I haven't explored the root cause of its conflict with the lazy loading of plugin managers' side.

szymonmaszke commented 5 years ago

@lesguillemets Oh, okay, this makes your issues much clearer to me, thank you. I would be more than happy to accept any PR (with some description of plugin managers and where this problem exists, I don't have much experience with those except for vim-plug).