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

Python files returns error #39

Open
Sicks3c opened this issue Aug 20, 2019 · 4 comments
Open

Python files returns error #39

Sicks3c opened this issue Aug 20, 2019 · 4 comments
Assignees
Labels

Comments

@Sicks3c
Copy link

Sicks3c commented Aug 20, 2019

Hello

I'm using Kali Os in virtualbox
I have followed the installation structure, Everything works fine but when I try to open a python file
I get this weird error

line    2:
E319: Sorry, the command is not available in this version: python import sys, vim
line    3:
E319: Sorry, the command is not available in this version: python sys.path.insert(0, vim.eval('a:plugin
_root'))
line    4:
E319: Sorry, the command is not available in this version: python sys.path = vim.eval('a:paths') + sys.
path
Error detected while processing /root/.vim/bundle/python-mode/autoload/pymode/virtualenv.vim:
line    3:
E319: Sorry, the command is not available in this version: python from pymode.virtualenv import enable_
virtualenv
Error detected while processing function pymode#breakpoint#init:
line    9:
E319: Sorry, the command is not available in this version: python << EOF
line   11:
E492: Not an editor command: from pymode.libs.six import PY3
line   13:
E121: Undefined variable: PY3
E15: Invalid expression: PY3:
line   17:
E488: Trailing characters: else:
line   20:
E488: Trailing characters:         try:
line   31:
E170: Missing :endfor
Tagbar: Exuberant ctags not found!
Please download Exuberant Ctags from ctags.sourceforge.net and install it in a directory in your $PATH
or set g:tagbar_ctags_bin.
Error detected while processing function tagbar#autoopen[9]..<SNR>116_IsValidFile:
line   29:
E121: Undefined variable: s:known_types
E116: Invalid arguments for function has_key(s:known_types, a:ftype)
E15: Invalid expression: !has_key(s:known_types, a:ftype)
Press ENTER or type command to continue
@rmk135 rmk135 self-assigned this Aug 20, 2019
@rmk135
Copy link
Member

rmk135 commented Aug 20, 2019

Hi @amiralkizaru ,

Can you, please, do $ vim --version and post output here?

Thanks,
Roman

@Sicks3c
Copy link
Author

Sicks3c commented Aug 20, 2019

Hello

Thanks for the fast reply
here:

VIM - Vi IMproved 8.1 (2018 May 18, compiled Aug 22 2018 23:46:39)
Included patches: 1-320
Modified by team+vim@tracker.debian.org
Compiled by team+vim@tracker.debian.org
Huge version with GTK2 GUI.  Features included (+) or not (-):
+acl               +extra_search      +mouse_netterm     +tag_old_static
+arabic            +farsi             +mouse_sgr         -tag_any_white
+autocmd           +file_in_path      -mouse_sysmouse    +tcl
+autochdir         +find_in_path      +mouse_urxvt       +termguicolors
-autoservername    +float             +mouse_xterm       +terminal
+balloon_eval      +folding           +multi_byte        +terminfo
+balloon_eval_term -footer            +multi_lang        +termresponse
+browse            +fork()            -mzscheme          +textobjects
++builtin_terms    +gettext           +netbeans_intg     +timers
+byte_offset       -hangul_input      +num64             +title
+channel           +iconv             +packages          +toolbar
+cindent           +insert_expand     +path_extra        +user_commands
+clientserver      +job               +perl              +vartabs
+clipboard         +jumplist          +persistent_undo   +vertsplit
+cmdline_compl     +keymap            +postscript        +virtualedit
+cmdline_hist      +lambda            +printer           +visual
+cmdline_info      +langmap           +profile           +visualextra
+comments          +libcall           -python            +viminfo
+conceal           +linebreak         +python3           +vreplace
+cryptv            +lispindent        +quickfix          +wildignore
+cscope            +listcmds          +reltime           +wildmenu
+cursorbind        +localmap          +rightleft         +windows
+cursorshape       +lua               +ruby              +writebackup
+dialog_con_gui    +menu              +scrollbind        +X11
+diff              +mksession         +signs             -xfontset
+digraphs          +modify_fname      +smartindent       +xim
+dnd               +mouse             +startuptime       +xpm
-ebcdic            +mouseshape        +statusline        +xsmp_interact
+emacs_tags        +mouse_dec         -sun_workshop      +xterm_clipboard
+eval              +mouse_gpm         +syntax            -xterm_save
+ex_extra          -mouse_jsbterm     +tag_binary        
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  system gvimrc file: "$VIM/gvimrc"
    user gvimrc file: "$HOME/.gvimrc"
2nd user gvimrc file: "~/.vim/gvimrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
    system menu file: "$VIMRUNTIME/menu.vim"
  fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK  -pthread -I/usr/include/gtk-2.0 -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include -I/usr/include/gio-unix-2.0/ -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng16 -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/fribidi -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16 -Wdate-time  -g -O2 -fdebug-prefix-map=/build/vim-9vcCse/vim-8.1.0320=. -fstack-protector-strong -Wformat -Werror=format-security -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1       
Linking: gcc   -L. -Wl,-z,relro -Wl,-z,now -fstack-protector -rdynamic -Wl,-export-dynamic -Wl,-E  -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -o vim   -lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lfontconfig -lfreetype -lSM -lICE -lXpm -lXt -lX11 -lXdmcp -lSM -lICE  -lm -ltinfo -lnsl  -lselinux  -lacl -lattr -lgpm -ldl  -L/usr/lib -llua5.2 -Wl,-E  -fstack-protector-strong -L/usr/local/lib  -L/usr/lib/x86_64-linux-gnu/perl/5.26/CORE -lperl -ldl -lm -lpthread -lcrypt  -L/usr/lib/python3.6/config-3.6m-x86_64-linux-gnu -lpython3.6m -lpthread -ldl -lutil -lm -L/usr/lib/x86_64-linux-gnu -ltcl8.6 -ldl -lz -lpthread -lm -lruby-2.5 -lpthread -lgmp -ldl -lcrypt -lm     

@cydanil
Copy link
Contributor

cydanil commented Apr 1, 2020

There might be two reasons why this issue appears:

  • either your vim does not support Python 3;
  • or you are using Python2 as an interpreter.

Does vim support Python 3?

To check this, run vim --version | grep python, and you should see something like:

$ vim --version | grep python
+comments          +libcall           -python            +vreplace
+conceal           +linebreak         +python3           +wildignore

Meaning Python3 but no Python 2 support. As of 2020, this seems to be the outcome of most vim binaries provided by various package managers.

Is your Python interpreter Python 3?

As of 2020, Python2 is the default interpreter on most Linux distros. Vim, however, requires a Python3 environment.
You can check this by running python --version:

$ python --version
Python 2.7.15+

If you use conda or similar Python installations, make sure to call the system's default, and not your shell's (eg. /usr/bin/python)

If indeed your interpreter is Python2, check that you have Python3 available:

$ python3 --version
Python 3.7.6

If so, you're set to resolve the issue by changing the vimrc, lines 154 and 155 to:

" python executables for different plugins                                                                                                                           
let g:pymode_python='python3'
let g:syntastic_python_python_exec='python3'

You should then be set :)

I'm not sure what the Python is on various systems, so I'm not sure whether to open a PR to fix these lines.

@ElegantLin
Copy link

@cydanil

Hi, I set vimrc as you suggested. But I still met the problem. My error message is

Exit code: 1
Error detected while processing BufEnter Autocommands for "*.py"..function tagbar#autoopen[9]..<SNR>116_IsValidFile:
line   29:
E121: Undefined variable: s:known_types
E116: Invalid arguments for function has_key(s:known_types, a:ftype)

Do you know the reason?

My OS is MacOS Big Sur and my vim version is

+comments          +libcall           -python            +visual
+conceal           +linebreak         +python3           +visualextra

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants