Closed sloria closed 10 years ago
I believe the Python code was initially written with Python 3 compatibility in mind. Could you try removing the check (or making it also pass when python3
is present), and tell me if you run into any problems?
I changed the following in autoload/tern.vim
:
if !has('python') && !has('python3')
echo 'tern requires python support'
finish
endif
to make the script execute.
However, when I open a JS file, I get the following error:
Error detected while processing /Users/sloria/.vim/plugged/tern_for_vim/autoload/tern.vim:
line 8:
E319: Sorry, the command is not available in this version: pyfile /Users/sloria/.vim/plugged/tern_for
_vim/script/tern.py
Try changing pyfile
to py3file
...
After changing to py3file
, I get a number of Python 3-related errors (e.g. usage of urllib2) in tern.py
.
I can work on a PR for Py2/3 compatibility this evening.
The tern_for_sublime
plugin has Python code that is known to run both in Python 2 and Python 3, you might want to steal some code from there.
Fixed in #78
I am still seeing this on Mac OSX after installing this plugin:
tern requires python support
tern requires python support
Error detected while processing /Users/rosenbek/Desktop/git/dotvim/bundle/tern_for_vim/after/ftplugin/javascript_tern.vim:
line 1:
E117: Unknown function: tern#Enable
Press ENTER or type command to continue
Python 2.7.5 is available in my path, not sure why this issue would occur. I installed python3 via homebrew to ensure I have python3
in my path, and still, same error
Looks like my vim is compiled w/out python support, probably this is the reason:
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Nov 4 2014 16:51:43)
MacOS X (unix) version
Included patches: 1-488
Compiled by Homebrew
Huge version without GUI. Features included (+) or not (-):
+acl +farsi +mouse_netterm +syntax
+arabic +file_in_path +mouse_sgr +tag_binary
+autocmd +find_in_path -mouse_sysmouse +tag_old_static
-balloon_eval +float +mouse_urxvt -tag_any_white
-browse +folding +mouse_xterm -tcl
++builtin_terms -footer +multi_byte +terminfo
+byte_offset +fork() +multi_lang +termresponse
+cindent -gettext -mzscheme +textobjects
-clientserver -hangul_input +netbeans_intg +title
+clipboard +iconv +path_extra -toolbar
+cmdline_compl +insert_expand +perl +user_commands
+cmdline_hist +jumplist +persistent_undo +vertsplit
+cmdline_info +keymap +postscript +virtualedit
+comments +langmap +printer +visual
+conceal +libcall +profile +visualextra
+cryptv +linebreak -python +viminfo
+cscope +lispindent -python3 +vreplace
+cursorbind +listcmds +quickfix +wildignore
+cursorshape +localmap +reltime +wildmenu
+dialog_con -lua +rightleft +windows
+diff +menu +ruby +writebackup
+digraphs +mksession +scrollbind -X11
-dnd +modify_fname +signs -xfontset
-ebcdic +mouse +smartindent -xim
+emacs_tags -mouseshape -sniff -xsmp
+eval +mouse_dec +startuptime -xterm_clipboard
+ex_extra -mouse_gpm +statusline -xterm_save
+extra_search -mouse_jsbterm -sun_workshop -xpm
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
2nd user vimrc file: "~/.vim/vimrc"
user exrc file: "$HOME/.exrc"
fall-back for $VIM: "/usr/local/share/vim"
Compilation: /usr/bin/clang -c -I. -Iproto -DHAVE_CONFIG_H -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -DMACOS_X_UNIX -Os -w -pipe -march=native -mmacosx-version-min=10.9 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: /usr/bin/clang -L. -L/usr/local/lib -L/usr/local/lib -Wl,-headerpad_max_install_names -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -o vim -lm -lncurses -liconv -framework Cocoa -fstack-protector -L/usr/local/lib -L/System/Library/Perl/5.16/darwin-thread-multi-2level/CORE -lperl -lruby.2.0.0 -lobjc
Looks like my vim is compiled w/out python support, probably this is the reason:
Indeed, that's the problem.
I've compiled vim with python3 support, and I get the following error when opening a javascript file:
This is because the plugin is checking for
has('python')
but not forhas('python3')
. Does tern_for_vim support python 3?