Open TheLocehiliosan opened 6 years ago
This line E319: Sorry, the command is not available in this version: python << EOF
usually indicates that your Vim version is not compiled with Python.
What is the output of :version
(or vim --version
)?
You should see something like this:
+python/dyn
+python3/dyn
Yeah, I was just coming back to post this info:
-python
+python3
I do have python support, but just python3.
Apparently Vim has different commands for Python 2 and Python 3. The equivalent commands to work in Python 3 would be python3 << EOF
According to this SO post about python 2/3 compatibility issues, using pythonx << EOF
should work for both.
I made a PR to change the commands just now, can you git checkout issues-1-python3-compatibility
and tell me if that fixes things for you?
@ColinKennedy - I can confirm, this change works for me. I'll close this issue.
I am curious to know how much of a dependency parso is. I'm curious because I don't really get the behavior I'm expecting. For example, within an "if" block, typing vib
does not visually select the lines of the "if" block.
Actually, I'll reopen.. just occurred to me that this change is not in "master" yet.
Merged the PR just now. The change is in master.
To answer your question parso
is basically the reason by this plugin exists.
parso
is used to find the block Python-block "boundaries" and then I use vim-textobj-user
to convert that into a visual selection. So parso
is necessary in respect to Block Party.
That said, Block Party provides its own parso
version. For reference, I don't have parso
installed onto my machine centrally. It just gets added and used through Block Party.
I am curious to know how much of a dependency parso is. I'm curious because I don't really get the behavior I'm expecting. For example, within an "if" block, typing vib does not visually select the lines of the "if" block.
Are you still having this issue even after pulling the latest master?
Sorry for the delay. I'm not having the original problem when using the master branch. However, the issue I mentioned about not selecting in an "if" block does remain.
Hi @TheLocehiliosan I got some time to compile Vim for Python 3 (only) and confirmed that it is working for me + unittests pass for Python 3.4-7.
Please send me the text block that you were working with (and where your cursor is positioned) and any other settings needed to replicate the issue
I get the same error in neovim. has('python{,3}')
= 1, but has('python2')
= 0
I finally got around to looking at this again. I think the "no action" was actually caused by me as I had put a conditional in my .vimrc based on has('python')
so I wouldn't have vim loading problems.
Now I've removed that conditional, and I've updated this plugin to the current origin/master. Now when I attempt to visually select, I get the following stack trace:
Error detected while processing function 7[2]..<SNR>34_select_function_wrapper[3]..vim_block_party#inside_shallow:
line 6:
Traceback (most recent call last):
File "/Users/tbyrne/.vim/plugged/vim-textobj-block-party/pythonx/vim_textobj_block_party/block_party/party.py", line 18, in <module>
from parso.python import tree
ModuleNotFoundError: No module named 'parso'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Users/tbyrne/.vim/plugged/vim-textobj-block-party/pythonx/vim_textobj_block_party/party.py", line 10, in <module>
from .block_party import party
File "/Users/tbyrne/.vim/plugged/vim-textobj-block-party/pythonx/vim_textobj_block_party/block_party/party.py", line 22, in <module>
from .vendors.parso.python import tree
File "/Users/tbyrne/.vim/plugged/vim-textobj-block-party/pythonx/vim_textobj_block_party/block_party/vendors/parso/__init__.py", line 41, in <module>
from parso.parser import ParserSyntaxError
ModuleNotFoundError: No module named 'parso'
I didn't look much farther than this, other than I was unable to simply run this file with python:
$ python ~/.vim/plugged/vim-textobj-block-party/pythonx/vim_textobj_block_party/block_party/vendors/parso/__init__.py
Traceback (most recent call last):
File "/Users/tbyrne/.vim/plugged/vim-textobj-block-party/pythonx/vim_textobj_block_party/block_party/vendors/parso/__init__.py", line 41, in <module>
from parso.parser import ParserSyntaxError
ImportError: No module named parso.parser
I'll see if I get some more time to look at this again.
Hi
About the pythonx-checking issue:
Apparently pythonx
isn't available in Vim < 8.0 and not at all in neovim currently (Reference: https://github.com/ColinKennedy/vim-python-function-expander/issues/1#issuecomment-436488414)
I'll write a workaround to deal with this.
@TheLocehiliosan That import error is my bad. I'll get a fix for it up soonish. In the meantime if you'd like, you can install parso globally and this plugin will use the global installation instead
@TheLocehiliosan This PR should fix fix the parso import issue as well as make this plugin compatible with older Vim versions: https://github.com/ColinKennedy/vim-textobj-block-party/pull/10. Please let me know if it works for you :+1:
Hi. I like the concept of this plugin, but it haven't been able to get it to work straight out. I added the plugin, along with the dependency of textobj-user. I have NOT installed parso, but the README indicates that it should not be necessary. Have you seen this problem before?