srusskih / SublimeJEDI

awesome Python autocompletion with SublimeText
MIT License
938 stars 109 forks source link

KeyError: u'\\\r\n' on numpy completion #176

Closed debjan closed 7 years ago

debjan commented 9 years ago

This issue seems like caused by either updating to current SublimeJedi or updating to numpy 1.9.2. I'm running ST from dev channel on Windows 7.

For example:

import numpy as np

np.

results in this debug messages:

SublimeJEDI.sublime_jedi.completion: JEDI completion triggered
SublimeJEDI.sublime_jedi.utils: Sending request to daemon for "autocomplete"
SublimeJEDI.sublime_jedi.utils: 2015-04-06 14:41:41,753: ERROR   : `JediFacade.get_autocomplete` failed
Traceback (most recent call last):
  File "daemon.py", line 121, in get
    return getattr(self, 'get_' + action)()
  File "daemon.py", line 140, in get_autocomplete
    data.extend(self._completion() or [])
  File "daemon.py", line 196, in _completion
    completions = self.script.completions()
  File "..\jedi\api\__init__.py", line 183, in completions
    completion_names = get_completions(user_stmt, b)
  File "..\jedi\api\__init__.py", line 169, in get_completions
    completion_names += self._simple_complete(path, dot, like)
  File "..\jedi\api\__init__.py", line 250, in _simple_complete
    for names_dict in s.names_dicts(search_global=False):
  File "..\jedi\evaluate\representation.py", line 717, in names_dicts
    for star_module in self.star_imports():
  File "..\jedi\cache.py", line 93, in wrapper
    value = next(generator)
  File "..\jedi\cache.py", line 170, in wrapper
    yield func(self)
  File "..\jedi\evaluate\cache.py", line 41, in wrapper
    rv = function(obj, *args, **kwargs)
  File "..\jedi\evaluate\representation.py", line 730, in star_imports
    new = imports.ImportWrapper(self._evaluator, name).follow()
  File "..\jedi\evaluate\cache.py", line 41, in wrapper
    rv = function(obj, *args, **kwargs)
  File "..\jedi\evaluate\imports.py", line 86, in follow
    module, rest = importer.follow_file_system()
  File "..\jedi\evaluate\cache.py", line 41, in wrapper
    rv = function(obj, *args, **kwargs)
  File "..\jedi\evaluate\imports.py", line 261, in follow_file_system
    return self._real_follow_file_system()
  File "..\jedi\evaluate\imports.py", line 283, in _real_follow_file_system
    module, rest = self._follow_sys_path(sys_path_mod)
  File "..\jedi\evaluate\imports.py", line 387, in _follow_sys_path
    return _load_module(self._evaluator, path, source, sys_path=sys_path), rest
  File "..\jedi\evaluate\imports.py", line 498, in _load_module
    return load(source) if cached is None else cached.module
  File "..\jedi\evaluate\imports.py", line 493, in load
    p = fast.FastParser(evaluator.grammar, common.source_to_unicode(source), p)
  File "..\jedi\parser\fast.py", line 106, in __call__
    p = super(CachedFastParser, self).__call__(grammar, source, module_path)
  File "..\jedi\parser\fast.py", line 243, in __init__
    self.update(source)
  File "..\jedi\parser\fast.py", line 257, in update
    self._parse(source)
  File "..\jedi\parser\fast.py", line 383, in _parse
    line_offset, nodes)
  File "..\jedi\parser\fast.py", line 435, in _get_node
    p = Parser(self._grammar, parser_code, self.module_path, tokenizer=tokenizer)
  File "..\jedi\parser\__init__.py", line 155, in __init__
    self.module = p.parse(self._tokenize(tokenizer))
  File "..\jedi\parser\pgen2\parse.py", line 105, in parse
    for type, value, prefix, start_pos in tokenizer:
  File "..\jedi\parser\__init__.py", line 343, in _tokenize
    typ = token.opmap[value]
KeyError: u'\\\r\n'
srusskih commented 9 years ago

something wrong with jedi parser https://github.com/davidhalter/jedi would be the better place for this bug

jcjf commented 9 years ago

I don't think it's the jedi parser (I have 0.9.0 installed), as this works fine with the autocomplete-python package for the Atom editor, which bundles jedi 0.9.0. I get an identical traceback with:

import argparse

argparse.
srusskih commented 9 years ago

Sorry but cannot reproduce with

import argparse
argparse.<alt+/>

PS: on linux

jcjf commented 9 years ago

I am on Windows 7 with Python 3.4. The problem with the carriage return is obviously a Windows thing, hmm...