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

NameError Traceback #26

Closed
levouh opened this issue Jun 3, 2020 · 5 comments
Closed

NameError Traceback #26

levouh opened this issue Jun 3, 2020 · 5 comments
Assignees
Labels
bug Something isn't working properly

Comments

@levouh
Copy link

levouh commented Jun 3, 2020

OS: Fedora 31

$ vim --version
VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Apr 14 2020 22:30:44)
Included patches: 1-579
...
$ vim --version | grep +timers
+channel           +insert_expand     +path_extra        +timers
$ vim --version | grep +python3
+conceal           +linebreak         +python3           +visualextra
$ python -V
3.7.6

Steps to reproduce

NOTE: Before doing this, I've run rm -rf ~/.vim.

  1. Install minPlug:
$ git clone https://github.com/Jorengarenar/minPlug.git ~/.vim/pack/plugins/opt/minPlug/
  1. Setup ~/.vim/vimrc are as follows:
packadd minPlug

MinPlug AlphaMycelium/pathfinder.vim
  1. Install plugins:
:MinPlugInstall!

While installing the plugins, the following happens:

Error detected while processing /home/amasquelier/.vim/pack/plugins/opt/pathfinder.vim/plugin/main.vim:
line   12:
E221: Marker cannot start with lower case letter
  File "<string>", line 1
    << endpython
     ^
SyntaxError: invalid syntax
line   13:
E1042: import/export can only be used in vim9script
line   14:
E1042: import/export can only be used in vim9script
line   15:
E492: Not an editor command: from os.path import normpath, join
line   17:
E492: Not an editor command: plugin_root_dir = vim.eval("fnamemodify(resolve(expand('<sfile>:p')), ':h')")
line   18:
E319: Sorry, the command is not available in this version: python_root_dir = normpath(join(plugin_root_dir, '..', 'python'))
line   19:
E492: Not an editor command: sys.path.insert(0, python_root_dir)
line   20:
E492: Not an editor command: endpython
line   27:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'commands'
  1. Try to reload Vim in verbose mode with vim -V, and observe:
Executing BufEnter Autocommands for "*"
autocommand sil call s:LocalBrowse(expand("<amatch>"))
Executing VimEnter Autocommands for "*"
Press ENTER or type command to continue
autocommand let s:timer = timer_start(100, 'PathfinderLoop', {'repeat': -1})
Press ENTER or type command to continue
Executing VimEnter Autocommands for "*"
Press ENTER or type command to continue
Error detected while processing function PathfinderLoop:
line    2:
Traceback (most recent call last):
Press ENTER or type command to continue
Error detected while processing function PathfinderLoop:
line    2:
  File "<string>", line 1, in <module>
Press ENTER or type command to continue
Error detected while processing function PathfinderLoop:
line    2:
NameError: name 'commands' is not defined
Press ENTER or type command to continue
Error detected while processing function PathfinderLoop:
line    6:
Traceback (most recent call last):
Press ENTER or type command to continue
Error detected while processing function PathfinderLoop:
line    6:
  File "<string>", line 1, in <module>
Press ENTER or type command to continue
Error detected while processing function PathfinderLoop:
line    6:
NameError: name 'commands' is not defined

Modifying the loop to do:

  function! PathfinderLoop(timer)
    " Check for responses from the server
    python3 print(sys.path)
    python3 commands.client.poll_responses()
    ...

shows the following:

['/usr/lib64/python37.zip', '/usr/lib64/python3.7', '/usr/lib64/python3.7/lib-dynload', '/usr/local/lib/python3.7/site-packages', '/usr/lib64/python3.7/site-packages', '/usr/lib/python3.7/site-packages', '_vim_path_']

so I'm not sure if this is something that minPlug is doing wrong, and how it works with other plugin managers. I'm also not sure how PYTHONPATH really works in regards to Vim.


Any ideas here?

@aryabhatta-dey
Copy link

aryabhatta-dey commented Jun 3, 2020

Can you try again? I just tried reproducing your bug. Started off with a clean .vim and .vimrc and installed minplug as given in https://github.com/Jorengarenar/minPlug. It installed flawlessly for me and also working. So the problem does not seem to me with pathfinder.vim or minplug which might make it harder to solve.
In case it matters I am using Arch with everything updated to latest as of today.

Edit - Can you try again with a different plugin manager. Which might make it easier to diagnose where the problem lies

@levouh
Copy link
Author

levouh commented Jun 3, 2020

I've done the following now:

NOTE: Before this, I've run rm -rf ~/.vim

  1. Install vim-plug:
$ curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
    https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
  1. Setup ~/.vim/vimrc like so:
call plug#begin('~/.vim/plugged')

Plug 'AlphaMycelium/pathfinder.vim'

call plug#end()
  1. Install plugins:
:PlugInstall
  1. Startup Vim, and get the following:
Error detected while processing /home/amasquelier/.vim/plugged/pathfinder.vim/plugin/main.vim:
line   12:
E221: Marker cannot start with lower case letter
  File "<string>", line 1
    << endpython
     ^
SyntaxError: invalid syntax
line   13:
E1042: import/export can only be used in vim9script
line   14:
E1042: import/export can only be used in vim9script
line   15:
E492: Not an editor command: from os.path import normpath, join
line   17:
E492: Not an editor command: plugin_root_dir = vim.eval("fnamemodify(resolve(expand('<sfile>:p')), ':h')")
line   18:
E319: Sorry, the command is not available in this version: python_root_dir = normpath(join(plugin_root_dir, '..', 'python'))
line   19:
E492: Not an editor command: sys.path.insert(0, python_root_dir)
line   20:
E492: Not an editor command: endpython
line   27:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'commands'
Press ENTER or type command to continue

@aryabhatta-dey
Copy link

aryabhatta-dey commented Jun 3, 2020

Thanks for following through
I think the problem is the same as this one psf/black#1347. It seems to me we might have the same bug.
The related issue vim/vim#4705
And the change https://github.com/vim/vim/releases/tag/v8.2.0578
Also it might be I am not being able to reproduce your problem on vanilla arch because there is a patch in vanilla arch vim which doesn't let this happen. Since I cannot reproduce it can you make two edits and let me know if that solves it for you?

  1. In ~/.vim/plugged/pathfinder.vim/plugin/main.vim line 12 change endpython to Endpython
  2. Same file line 20 change endpython to Endpython

@danth danth added the bug Something isn't working properly label Jun 3, 2020
@levouh
Copy link
Author

levouh commented Jun 5, 2020

I apologize for the delayed response, and again because I know this doesn't help determine the root cause, but I've updated to the latest patch (8.0905) and the plugin is working as intended.

I noticed that you mentioned the fix being in patch 0578, but note that the version I mentioned using was 0579:

$ vim --version
VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Apr 14 2020 22:30:44)
Included patches: 1-579
...

Because my upgrades have been a detriment towards potentially solving the problem, albeit with possibly 2 characters as well, I'd be happy to help by reverting my update and trying what you'd mentioned above. However, I don't want to go to the effort if you don't need me to. Let me know @aryabhatta-dey.

@aryabhatta-dey
Copy link

R e thanks for replying back.. the delay is nothing. I am glad that it's working for you. Then I will go ahead and close the issue. Hope you find the plugin helpful and do drop by to report on anything new or for PRs. Hope to see you again:)

PS - I meant in 578 they introduced the breaking change. It seems somewhere along the line in a later patch they have reverted to allow both endpython and Endpython. That is why I couldn't reproduce it on my system and why it got fixed for you automatically. Still this was helpful issue as in case someone else runs in a similar issue in the future they can easily solve the bug

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working properly
Projects
None yet
Development

No branches or pull requests

3 participants