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

jedi-vim failed to initialize Python: "AttributeError: closed" through colorama #534

Closed
atttx123 opened this issue Jan 22, 2016 · 3 comments

Comments

@atttx123
Copy link

when i use vim-jedi, i get error below:

Error: jedi-vim failed to initialize Python: jedi#setup_py_version: Vim(pyfile):Traceback (most recent call last): (in function jedi#init_python..<SNR>76_init_python..jedi#setup_py_version, line 18)

when i use :py import jedi in vim, i get error below:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python2.7/dist-packages/jedi/__init__.py", line 39, in <module>
    from jedi.api import Script, Interpreter, NotFoundError, set_debug_function
  File "/usr/lib/python2.7/dist-packages/jedi/api/__init__.py", line 18, in <module>
    from jedi.parser import Parser
  File "/usr/lib/python2.7/dist-packages/jedi/parser/__init__.py", line 21, in <module>
    from jedi import debug
  File "/usr/lib/python2.7/dist-packages/jedi/debug.py", line 17, in <module>
    init()
  File "/usr/local/lib/python2.7/dist-packages/colorama/initialise.py", line 37, in init
    wrap_stream(orig_stdout, convert, strip, autoreset, wrap)
  File "/usr/local/lib/python2.7/dist-packages/colorama/initialise.py", line 76, in wrap_stream
    convert=convert, strip=strip, autoreset=autoreset)
  File "/usr/local/lib/python2.7/dist-packages/colorama/ansitowin32.py", line 67, in __init__
    strip = conversion_supported or (not wrapped.closed and not is_a_tty(wrapped))
AttributeError: closed

my vim :ver:

:ver
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Mar 31 2015 23:35:24)
Included patches: 1-488, 576
Modified by pkg-vim-maintainers@lists.alioth.debian.org
Compiled by jamessan@debian.org
Huge version without GUI.  Features included (+) or not (-):
+acl             +cmdline_compl   +diff            +find_in_path    +keymap          +modify_fname    +mouse_xterm     +profile         -sniff           +termresponse    +vreplace        -xterm_save
+arabic          +cmdline_hist    +digraphs        +float           +langmap         +mouse           +multi_byte      +python          +startuptime     +textobjects     +wildignore      -xpm
+autocmd         +cmdline_info    -dnd             +folding         +libcall         -mouseshape      +multi_lang      -python3         +statusline      +title           +wildmenu
-balloon_eval    +comments        -ebcdic          -footer          +linebreak       +mouse_dec       -mzscheme        +quickfix        -sun_workshop    -toolbar         +windows
-browse          +conceal         +emacs_tags      +fork()          +lispindent      +mouse_gpm       +netbeans_intg   +reltime         +syntax          +user_commands   +writebackup
++builtin_terms  +cryptv          +eval            +gettext         +listcmds        -mouse_jsbterm   +path_extra      +rightleft       +tag_binary      +vertsplit       -X11
+byte_offset     +cscope          +ex_extra        -hangul_input    +localmap        +mouse_netterm   +perl            +ruby            +tag_old_static  +virtualedit     -xfontset
+cindent         +cursorbind      +extra_search    +iconv           +lua             +mouse_sgr       +persistent_undo +scrollbind      -tag_any_white   +visual          -xim
-clientserver    +cursorshape     +farsi           +insert_expand   +menu            -mouse_sysmouse  +postscript      +signs           +tcl             +visualextra     -xsmp
-clipboard       +dialog_con      +file_in_path    +jumplist        +mksession       +mouse_urxvt     +printer         +smartindent     +terminfo        +viminfo         -xterm_clipboard
   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/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H     -g -O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1     -I/usr/include/tcl8.6  -D_REENTRANT=1  -D_THREAD
_SAFE=1  -D_LARGEFILE64_SOURCE=1
Linking: gcc   -L. -Wl,-z,relro -L/build/ruby2.1-64qTCU/ruby2.1-2.1.5/debian/lib -fstack-protector -rdynamic -Wl,-export-dynamic -Wl,-E  -fPIE -pie -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -o vim        -lm -ltinfo
 -lnsl  -lselinux  -lacl -lattr -lgpm -ldl  -L/usr/lib -llua5.2 -Wl,-E  -fstack-protector -L/usr/local/lib  -L/usr/lib/x86_64-linux-gnu/perl/5.20/CORE -lperl -ldl -lm -lpthread -lcrypt -L/usr/lib/python2.7/config-
x86_64-linux-gnu -lpython2.7 -lpthread -ldl -lutil -lm -Xlinker -export-dynamic -Wl,-O1 -Wl,-Bsymbolic-functions  -L/usr/lib/x86_64-linux-gnu -ltcl8.6 -ldl -lz -lpthread -lieee -lm -lruby-2.1 -lpthread -lgmp -ldl
-lcrypt -lm

my local jedi-vim version:

commit 625c568b1249db8c5f1b06a1f9371c06ba2d08b5
Merge: dc23f0b 8215b22
Author: Dave Halter <davidhalter88@gmail.com>
Date:   Thu Jan 14 14:14:44 2016 +0100

    Merge pull request #527 from prologic/master

    Fixes Python 2.6 compatibility issues with `str.format()`

python sys.path in vim:

['/usr/local/lib/python2.7/dist-packages/webkit2png-0.8.3-py2.7.egg', '/home/yu/Workspace/python', '/usr/local/lib/python2.7/dist-packages', '/usr/local/lib/python2.7/site-packages', '/usr/lib/python2.7', '/usr/li
b/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages/PILcompat', '/
usr/lib/python2.7/dist-packages/gtk-2.0', '/usr/lib/pymodules/python2.7', '_vim_path_']

my vimrc:

" jedi-vim
let g:jedi#use_tabs_not_buffers = 0 
" let g:jedi#use_splits_not_buffers = "left"
let g:jedi#goto_assignments_command = "<leader>g"
let g:jedi#goto_definitions_command = "<leader>b"
let g:jedi#documentation_command = "<leader>d"
let g:jedi#usages_command = "<leader>u"
let g:jedi#completions_command = "<C-Space>"
let g:jedi#rename_command = "<leader>r"
let g:jedi#show_call_signatures = "1" 
@blueyed blueyed changed the title [Linux x64] [VIM 7.4] jedi-vim failed to initialize Python jedi-vim failed to initialize Python: "AttributeError: closed" through colorama Jan 22, 2016
@blueyed
Copy link
Collaborator

blueyed commented Jan 22, 2016

Duplicate of #522 and caused by colorama 0.3.6.

See #522 (comment) and following.

@blueyed blueyed closed this as completed Jan 22, 2016
@atttx123
Copy link
Author

@blueyed i revert to colorama 0.3.4 and work well, thank so much

@noscripter
Copy link

Yes, I encountered the same problem too, reinstall colorama of version 0.3.4 fixes this issue: pip install 'colorama==0.3.4' --force-reinstall

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

No branches or pull requests

3 participants