Closed tweekmonster closed 6 years ago
Thank you so much! (And sorry for being such a pain!). It seems to work :)
It's no problem at all!
Terribly sorry to disturb you again. Mmm I just got a new exception:
[impsort] Traceback (most recent call last):
[impsort] File "/Users/pedro/git-repos/private/dotfiles/vim/bundle/repos/github.com/tweekmonster/impsort.vim/bin/imports.py", line 48, in <module>
[impsort] get_names(sys.argv[1], source)
[impsort] File "/Users/pedro/git-repos/private/dotfiles/vim/bundle/repos/github.com/tweekmonster/impsort.vim/bin/imports.py", line 36, in get_names
[impsort] print('%s,%s' % (c.name, c.type))
[impsort] File "/Users/pedro/git-repos/private/dotfiles/vim/bundle/repos/github.com/tweekmonster/impsort.vim/bin/jedi/jedi/api/classes.py", line 148, in type
[impsort] for context in self._name.infer():
[impsort] File "/Users/pedro/git-repos/private/dotfiles/vim/bundle/repos/github.com/tweekmonster/impsort.vim/bin/jedi/jedi/evaluate/filters.py", line 100, in infer
[impsort] return tree_name_to_contexts(self.parent_context.evaluator, self.parent_context, self.tree_name)
[impsort] File "/Users/pedro/git-repos/private/dotfiles/vim/bundle/repos/github.com/tweekmonster/impsort.vim/bin/jedi/jedi/evaluate/syntax_tree.py", line 485, in tree_name_to_contexts
[impsort] types = imports.infer_import(context, tree_name)
[impsort] File "/Users/pedro/git-repos/private/dotfiles/vim/bundle/repos/github.com/tweekmonster/impsort.vim/bin/jedi/jedi/evaluate/cache.py", line 40, in wrapper
[impsort] rv = function(obj, *args, **kwargs)
[impsort] File "/Users/pedro/git-repos/private/dotfiles/vim/bundle/repos/github.com/tweekmonster/impsort.vim/bin/jedi/jedi/evaluate/imports.py", line 77, in infer_import
[impsort] for t in types
[impsort] File "/Users/pedro/git-repos/private/dotfiles/vim/bundle/repos/github.com/tweekmonster/impsort.vim/bin/jedi/jedi/evaluate/utils.py", line 17, in unite
[impsort] return set(typ for types in iterable for typ in types)
[impsort] File "/Users/pedro/git-repos/private/dotfiles/vim/bundle/repos/github.com/tweekmonster/impsort.vim/bin/jedi/jedi/evaluate/utils.py", line 17, in <genexpr>
[impsort] return set(typ for types in iterable for typ in types)
[impsort] File "/Users/pedro/git-repos/private/dotfiles/vim/bundle/repos/github.com/tweekmonster/impsort.vim/bin/jedi/jedi/evaluate/imports.py", line 77, in <genexpr>
[impsort] for t in types
[impsort] File "/Users/pedro/git-repos/private/dotfiles/vim/bundle/repos/github.com/tweekmonster/impsort.vim/bin/jedi/jedi/_compatibility.py", line 204, in <lambda>
[impsort] return lambda *args, **kwargs: self.func(obj, *args, **kwargs)
[impsort] File "/Users/pedro/git-repos/private/dotfiles/vim/bundle/repos/github.com/tweekmonster/impsort.vim/bin/jedi/jedi/evaluate/base_context.py", line 140, in py__getattribute__
[impsort] return f.find(filters, attribute_lookup=not search_global)
[impsort] File "/Users/pedro/git-repos/private/dotfiles/vim/bundle/repos/github.com/tweekmonster/impsort.vim/bin/jedi/jedi/debug.py", line 79, in wrapper
[impsort] return func(*args, **kwargs)
[impsort] File "/Users/pedro/git-repos/private/dotfiles/vim/bundle/repos/github.com/tweekmonster/impsort.vim/bin/jedi/jedi/evaluate/finder.py", line 64, in find
[impsort] types = self._names_to_types(names, attribute_lookup)
[impsort] File "/Users/pedro/git-repos/private/dotfiles/vim/bundle/repos/github.com/tweekmonster/impsort.vim/bin/jedi/jedi/evaluate/finder.py", line 157, in _names_to_types
[impsort] contexts = ContextSet.from_sets(name.infer() for name in names)
[impsort] File "/Users/pedro/git-repos/private/dotfiles/vim/bundle/repos/github.com/tweekmonster/impsort.vim/bin/jedi/jedi/common/context.py", line 34, in from_sets
[impsort] sets = list(sets)
[impsort] File "/Users/pedro/git-repos/private/dotfiles/vim/bundle/repos/github.com/tweekmonster/impsort.vim/bin/jedi/jedi/evaluate/finder.py", line 157, in <genexpr>
[impsort] contexts = ContextSet.from_sets(name.infer() for name in names)
[impsort] File "/Users/pedro/git-repos/private/dotfiles/vim/bundle/repos/github.com/tweekmonster/impsort.vim/bin/jedi/jedi/evaluate/filters.py", line 100, in infer
[impsort] return tree_name_to_contexts(self.parent_context.evaluator, self.parent_context, self.tree_name)
[impsort] File "/Users/pedro/git-repos/private/dotfiles/vim/bundle/repos/github.com/tweekmonster/impsort.vim/bin/jedi/jedi/evaluate/syntax_tree.py", line 479, in tree_name_to_contexts
[impsort] types = _remove_statements(evaluator, context, node, tree_name)
[impsort] File "/Users/pedro/git-repos/private/dotfiles/vim/bundle/repos/github.com/tweekmonster/impsort.vim/bin/jedi/jedi/evaluate/syntax_tree.py", line 441, in _remove_statements
[impsort] return eval_expr_stmt(context, stmt, seek_name=name)
[impsort] File "/Users/pedro/git-repos/private/dotfiles/vim/bundle/repos/github.com/tweekmonster/impsort.vim/bin/jedi/jedi/evaluate/syntax_tree.py", line 46, in wrapper
[impsort] return func(context, *args, **kwargs)
[impsort] File "/Users/pedro/git-repos/private/dotfiles/vim/bundle/repos/github.com/tweekmonster/impsort.vim/bin/jedi/jedi/evaluate/syntax_tree.py", line 225, in eval_expr_stmt
[impsort] return _eval_expr_stmt(context, stmt, seek_name)
[impsort] File "/Users/pedro/git-repos/private/dotfiles/vim/bundle/repos/github.com/tweekmonster/impsort.vim/bin/jedi/jedi/debug.py", line 79, in wrapper
[impsort] return func(*args, **kwargs)
[impsort] File "/Users/pedro/git-repos/private/dotfiles/vim/bundle/repos/github.com/tweekmonster/impsort.vim/bin/jedi/jedi/evaluate/syntax_tree.py", line 241, in _eval_expr_stmt
[impsort] context_set = context.eval_node(rhs)
[impsort] File "/Users/pedro/git-repos/private/dotfiles/vim/bundle/repos/github.com/tweekmonster/impsort.vim/bin/jedi/jedi/evaluate/base_context.py", line 123, in eval_node
[impsort] return self.evaluator.eval_element(self, node)
[impsort] File "/Users/pedro/git-repos/private/dotfiles/vim/bundle/repos/github.com/tweekmonster/impsort.vim/bin/jedi/jedi/evaluate/__init__.py", line 179, in eval_element
[impsort] return self._eval_element_if_evaluated(context, element)
[impsort] File "/Users/pedro/git-repos/private/dotfiles/vim/bundle/repos/github.com/tweekmonster/impsort.vim/bin/jedi/jedi/evaluate/__init__.py", line 191, in _eval_element_if_evaluated
[impsort] return self._eval_element_cached(context, element)
[impsort] File "/Users/pedro/git-repos/private/dotfiles/vim/bundle/repos/github.com/tweekmonster/impsort.vim/bin/jedi/jedi/evaluate/cache.py", line 40, in wrapper
[impsort] rv = function(obj, *args, **kwargs)
[impsort] File "/Users/pedro/git-repos/private/dotfiles/vim/bundle/repos/github.com/tweekmonster/impsort.vim/bin/jedi/jedi/evaluate/__init__.py", line 195, in _eval_element_cached
[impsort] return eval_node(context, element)
[impsort] File "/Users/pedro/git-repos/private/dotfiles/vim/bundle/repos/github.com/tweekmonster/impsort.vim/bin/jedi/jedi/debug.py", line 79, in wrapper
[impsort] return func(*args, **kwargs)
[impsort] File "/Users/pedro/git-repos/private/dotfiles/vim/bundle/repos/github.com/tweekmonster/impsort.vim/bin/jedi/jedi/evaluate/syntax_tree.py", line 46, in wrapper
[impsort] return func(context, *args, **kwargs)
[impsort] File "/Users/pedro/git-repos/private/dotfiles/vim/bundle/repos/github.com/tweekmonster/impsort.vim/bin/jedi/jedi/evaluate/syntax_tree.py", line 58, in eval_node
[impsort] return eval_atom(context, element)
[impsort] File "/Users/pedro/git-repos/private/dotfiles/vim/bundle/repos/github.com/tweekmonster/impsort.vim/bin/jedi/jedi/evaluate/syntax_tree.py", line 191, in eval_atom
[impsort] return context.eval_node(c[1])
[impsort] File "/Users/pedro/git-repos/private/dotfiles/vim/bundle/repos/github.com/tweekmonster/impsort.vim/bin/jedi/jedi/evaluate/base_context.py", line 123, in eval_node
[impsort] return self.evaluator.eval_element(self, node)
[impsort] File "/Users/pedro/git-repos/private/dotfiles/vim/bundle/repos/github.com/tweekmonster/impsort.vim/bin/jedi/jedi/evaluate/__init__.py", line 179, in eval_element
[impsort] return self._eval_element_if_evaluated(context, element)
[impsort] File "/Users/pedro/git-repos/private/dotfiles/vim/bundle/repos/github.com/tweekmonster/impsort.vim/bin/jedi/jedi/evaluate/__init__.py", line 191, in _eval_element_if_evaluated
[impsort] return self._eval_element_cached(context, element)
[impsort] File "/Users/pedro/git-repos/private/dotfiles/vim/bundle/repos/github.com/tweekmonster/impsort.vim/bin/jedi/jedi/evaluate/cache.py", line 40, in wrapper
[impsort] rv = function(obj, *args, **kwargs)
[impsort] File "/Users/pedro/git-repos/private/dotfiles/vim/bundle/repos/github.com/tweekmonster/impsort.vim/bin/jedi/jedi/evaluate/__init__.py", line 195, in _eval_element_cached
[impsort] return eval_node(context, element)
[impsort] File "/Users/pedro/git-repos/private/dotfiles/vim/bundle/repos/github.com/tweekmonster/impsort.vim/bin/jedi/jedi/debug.py", line 79, in wrapper
[impsort]
[impsort] return func(*args, **kwargs)
[impsort] File "/Users/pedro/git-repos/private/dotfiles/vim/bundle/repos/github.com/tweekmonster/impsort.vim/bin/jedi/jedi/evaluate/syntax_tree.py", line 46, in wrapper
[impsort] return func(context, *args, **kwargs)
[impsort] File "/Users/pedro/git-repos/private/dotfiles/vim/bundle/repos/github.com/tweekmonster/impsort.vim/bin/jedi/jedi/evaluate/syntax_tree.py", line 84, in eval_node
[impsort] context_set = eval_trailer(context, context_set, trailer)
[impsort] File "/Users/pedro/git-repos/private/dotfiles/vim/bundle/repos/github.com/tweekmonster/impsort.vim/bin/jedi/jedi/evaluate/syntax_tree.py", line 153, in eval_trailer
[impsort] return base_contexts.execute(args)
[impsort] File "/Users/pedro/git-repos/private/dotfiles/vim/bundle/repos/github.com/tweekmonster/impsort.vim/bin/jedi/jedi/common/context.py", line 65, in mapper
[impsort] for context in self._set
[impsort] File "/Users/pedro/git-repos/private/dotfiles/vim/bundle/repos/github.com/tweekmonster/impsort.vim/bin/jedi/jedi/common/context.py", line 34, in from_sets
[impsort]
[impsort] sets = list(sets)
[impsort] File "/Users/pedro/git-repos/private/dotfiles/vim/bundle/repos/github.com/tweekmonster/impsort.vim/bin/jedi/jedi/common/context.py", line 65, in <genexpr>
[impsort]
[impsort]
[impsort] for context in self._set
[impsort] File "/Users/pedro/git-repos/private/dotfiles/vim/bundle/repos/github.com/tweekmonster/impsort.vim/bin/jedi/jedi/debug.py", line 79, in wrapper
[impsort]
[impsort] return func(*args, **kwargs)
[impsort] File "/Users/pedro/git-repos/private/dotfiles/vim/bundle/repos/github.com/tweekmonster/impsort.vim/bin/jedi/jedi/evaluate/base_context.py", line 42, in execute
[impsort]
[impsort] return stdlib.execute(self.evaluator, self, arguments)
[impsort] File "/Users/pedro/git-repos/private/dotfiles/vim/bundle/repos/github.com/tweekmonster/impsort.vim/bin/jedi/jedi/evaluate/stdlib.py", line 73, in execute
[impsort]
[impsort] return func(evaluator, obj, arguments)
[impsort]
[impsort] File "/Users/pedro/git-repos/private/dotfiles/vim/bundle/repos/github.com/tweekmonster/impsort.vim/bin/jedi/jedi/evaluate/stdlib.py", line 269, in collections_namedtuple
[impsort]
[impsort]
[impsort] _fields = list(_follow_param(evaluator, arguments, 1))[0]
[impsort]
[impsort] IndexError:
[impsort] list index out of range
[impsort]
[impsort]
This is my neovim :version
result (basically latest from master branch):
:version
NVIM v0.2.3-502-g300d3651e
Build type: Release
LuaJIT 2.0.5
Compilation: /usr/local/Homebrew/Library/Homebrew/shims/super/clang -Wconversion -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DNDEBUG -DMIN_LOG_LEVEL=3 -Wall -Wextra
-pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -I/tmp/neovim-20180127-72900-mxn8w3/
build/config -I/tmp/neovim-20180127-72900-mxn8w3/src -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/opt/gettext/include
-I/usr/include -I/tmp/neovim-20180127-72900-mxn8w3/build/src/nvim/auto -I/tmp/neovim-20180127-72900-mxn8w3/build/include
Compiled by pedro@Pedros-MacBook-Pro
Features: +acl +iconv +jemalloc +tui
See ":help feature-compile"
system vimrc file: "$VIM/sysinit.vim"
fall-back for $VIM: "/usr/local/Cellar/neovim/HEAD-300d365/share/nvim"
Run :checkhealth for more info
BTW, this is my :checkhealth
output:
health#jedi#check
========================================================================
## jedi
#### Jedi-vim debug information
Using Python version: 3
- sys.version: `3.6.4 (default, Jan 6 2018, 11:51:59), [GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.39.2)]`
- site module: `/usr/local/Cellar/python3/3.6.4_2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site.py`
Jedi path: `/Users/pedro/.config/nvim/bundle/repos/github.com/davidhalter/jedi-vim/pythonx/jedi/jedi/__init__.py`
- version: 0.11.1
- sys_path:
- `/usr/local/Cellar/python3/3.6.4_2/Frameworks/Python.framework/Versions/3.6/lib/python36.zip`
- `/usr/local/Cellar/python3/3.6.4_2/Frameworks/Python.framework/Versions/3.6/lib/python3.6`
- `/usr/local/Cellar/python3/3.6.4_2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/lib-dynload`
- `/usr/local/lib/python3.6/site-packages`
- `/usr/local/lib/python3.6/site-packages/aeosa`
- `/Users/pedro/git-repos/work/macross`
- `_vim_path_`
- jedi-vim git version: 0.8.0-125-g79ced22
- jedi git submodule status: 02f238ce08f2d7f9c4af9a17cbf5754836775e2f pythonx/jedi (v0.11.1)
2ca629a2f6db2e905ddd5188113b1045f8a00fc2 pythonx/parso (v0.1.1)
##### Settings
g:jedi#force_py_version = 3 (default: 'auto')
g:jedi#use_splits_not_buffers = 'winwidth' (default: 1)
g:jedi#usages_command = '
omnifunc=htmlcomplete#CompleteTags Last set from ~/git-repos/private/dotfiles/vim/init.vim completeopt=menuone,preview,noinsert Last set from ~/git-repos/private/dotfiles/vim/init.vim
health#deoplete#check
========================================================================
## deoplete.nvim
- OK: has("nvim") was successful
- OK: has("python3") was successful
- INFO: If you're still having problems, try the following commands:
$ export NVIM_PYTHON_LOG_FILE=/tmp/log
$ export NVIM_PYTHON_LOG_LEVEL=DEBUG
$ nvim
$ cat /tmp/log_{PID}
and then create an issue on github
health#nvim#check
========================================================================
## Configuration
- OK: no issues found
## Performance
- OK: Build type: Release
## Remote Plugins
- OK: Up to date
## terminal
- INFO: key_backspace (kbs) terminfo entry: key_backspace=\177
- INFO: key_dc (kdch1) terminfo entry: key_dc=\E[3~
- INFO: $TERM_PROGRAM='iTerm.app'
- INFO: $COLORTERM='truecolor'
## tmux
- OK: escape-time: 0ms
- INFO: $TERM: tmux-256color
health#provider#check
========================================================================
## Clipboard (optional)
- OK: Clipboard tool found: pbcopy
## Python 2 provider (optional)
- INFO: `g:python_host_prog` is not set. Searching for python2 in the environment.
- INFO: Executable: /usr/local/bin/python2
- INFO: Python2 version: 2.7.14
- INFO: python2-neovim version: 0.2.0
- OK: Latest python2-neovim is installed: 0.2.0
## Python 3 provider (optional)
- INFO: Using: g:python3_host_prog = "/usr/local/bin/python3"
- INFO: Executable: /usr/local/bin/python3
- INFO: Python3 version: 3.6.4
- INFO: python3-neovim version: 0.2.0
- OK: Latest python3-neovim is installed: 0.2.0
## Ruby provider (optional)
- INFO: Ruby: ruby 2.3.3p222 (2016-11-21 revision 56859) [universal.x86_64-darwin17]
- WARNING: `neovim-ruby-host` not found.
- ADVICE:
- Run `gem install neovim` to ensure the neovim RubyGem is installed.
- Run `gem environment` to ensure the gem bin directory is in $PATH.
- If you are using rvm/rbenv/chruby, try "rehashing".
- See :help |g:ruby_host_prog| for non-standard gem installations.
## Node.js provider (optional)
- INFO: Node.js: v9.4.0
- WARNING: Missing "neovim" npm package.
- ADVICE:
- Run in shell: npm install -g neovim
- Is the npm bin directory in $PATH?
Please let me know if anything else is needed to help you debugging/reproducing.
@petobens I'm unable to reproduce. Could you try updating the submodules?
git submodule update --init --recursive
I think i found a way to reproduce it (with the latest submodules). Create the following two files in your ~/Desktop/foo
dir:
i) config.py
from collections import namedtuple
env = 'dev'
_constants = {'TMP_DIR': f'/tmp/{env}/'}
constants = (namedtuple('Constants', _constants)(**_constants))
ii) main.py
from config import constants
Now save main.py
with :w
(or simply open that file). In my case (hopefully in yours too) errors will appear.
Thanks for the patience!
I'm unable to reproduce this. Based on the info above, you could try this:
cat ~/Desktop/foo/main.py | /usr/local/bin/python3 /Users/pedro/git-repos/private/dotfiles/vim/bundle/repos/github.com/tweekmonster/impsort.vim/bin/impsort.py ~/Desktop/foo/main.py
This is the output I get:
constants,instance
__doc__,instance
__file__,instance
__name__,instance
__package__,instance
I'm getting the same output as you are.
Can you reproduce my error with the following init.vim
file:
let $DOTVIM = expand('$HOME/.config/nvim')
if has('vim_starting')
execute 'set runtimepath+=' . expand(
\ '$DOTVIM/bundle/repos/github.com/Shougo/dein.vim')
endif
if dein#load_state(expand('$DOTVIM/bundle/'))
call dein#begin(expand('$DOTVIM/bundle/'))
call dein#add('tweekmonster/impsort.vim', {'on_ft' : 'python'})
" call dein#add('tweekmonster/impsort.vim')
call dein#end()
call dein#save_state()
endif
filetype plugin indent on
It might have something to do with dein
's on_ft
? Thanks :)
Sorry I didn't see this sooner. I don't use dein, so I wouldn't even know where to begin debugging if that's a problem. Does it work fine without on_ft
? It may be easier for you to see if the problem persists without any other plugin enabled, dein included.
I''ll try to reproduce it without dein and report back. Thank you!
@petobens Could you see if this resolves your issues. I wasn't able to see any exceptions, but I did have a problem with empty error messages being emitted.
If you're still getting exceptions, could you give me a little more info such as what Python version you're using for nvim.