Roland Puntaier wrote:
> E836: This Vim cannot execute :python after using :py3
> This happened to me several times already when changing to a buffer with
> python code, e.g. to my .vimrc file. The reason was that omnifunc was
> set to pythoncomplete#Complete.
>
> Python 2.6 and python 2.7 have had changes to make it more compatible
> with python3. It is now quite easy to write code that works for both,
> python2.x and python3.x.
You mean Python 2.6, 2.7 and 3.x. Not for Python 2.5 and earlier.
> With the error message triggering and the latter thought I tried to go
> for the following: forward to the other python command.
>
> - The first time vim realizes that it cannot run python (py3) because of
> the RTLD problem this error message is issued:
>
> E836: This Vim cannot execute :python after using :py3. Will
> forward future calls to :py3.
> or
> E837: This Vim cannot execute :py3 after using :python. Will
> forward future calls to python.
>
> (Of course, I've not changed the translations of the these messages.)
> - The second time the python command is forwarded to the other python
> command
> - If the system/python version allows both, python 2.x and python 3.x,
> there is no forwarding.
> - This applies only if vim is configure for both python versions
>
> If somebody has a script, which uses either :py3 or :python, the
> following sequence in the .vimrc as first python interaction will
> redirect all calls to :py3.
>
> "redirect :python to :py3
> py3 3
> python 2
> "argument has no meaning
>
> If the order is changed :py3 calls will be redirected to :python.
>
> @Bram: If you agree, please merge it to the main vim line.
>
> @Aaron: Since the changes in python3complete.vim do work for python 2.6
> and python 2.7 (I've test it), I have moved it to pythoncomplete.vim.
> The patch contains this move. The original pythoncomplete.vim I've moved
> to python25complete.vim with according internal renaming. It is attached.
> Do you agree with this proceeding?
> I'm moving to ArchLinux and in the vim package there pythoncomplete.vim
> is separate. The same version is already included in the vim sources.
I know quite a few people use Python 2.4, because some scripts don't
work with later versions.
I don't like getting an error only the first time something goes wrong,
it can easily be missed.
Why not add a way to ask Vim what Python versions are available. This
can use PYTHON_API_VERSION or PY_VERSION_HEX. Depending on that a
script can try loading the version it wants and check with has() if it's
actually available. Then define a user command with :py3 or :python, as
desired. Or give an error message if the Python version is not
supported.
Something like:
if pythonversion() =~ '2\.[67]' && has('python')
command Pyt python
elseif pythonversion() =~ '3\.' && has('python3')
command Pyt py3
else
echoerr "No usable Python version"
endif
--
A special cleaning ordinance bans housewives from hiding dirt and dust under a
rug in a dwelling.
[real standing law in Pennsylvania, United States of America]
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php