Skip to content

jedi throwing errror while entering multi-line code #173

Open
@mjaustin2

Description

@mjaustin2

Trying to put in the multi-line code below. When I get to the o in 'for' it throws the exception below. To eliminate module issues I'm running ptpython from a minimal virtualenv.

>>> from timeit import timeit
  2 setup = """\
  3 import netaddr
  4 import netlib
  5 import struct
  6 import socket
  7 import ipcalc
  8 net = '192.168.1.0/24'
  9 ip = '192.168.1.1'
 10 filename='/tmp/nets_to_check'
 11 nets_to_check = netlib.slurp(filename=filename)
 12 print 'nets in nets_to_check', len(nets_to_check)
 13 """
>>> code = """\
  2 fException in thread Thread-296:
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 810, in __bootstrap_inner
    self.run()     
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 763, in run
    self.__target(*self.__args, **self.__kwargs)e mode                                                                            [F2] Menu - CPython 2.7.10 
  File "/Users/joeschmoe/dev/ptpython/lib/python2.7/site-packages/prompt_toolkit/interface.py", line 860, in run
    completions = list(buffer.completer.get_completions(document, complete_event))
  File "/Users/joeschmoe/dev/ptpython/lib/python2.7/site-packages/ptpython/completer.py", line 127, in get_completions
    completions = script.completions()
  File "/Users/joeschmoe/dev/ptpython/lib/python2.7/site-packages/jedi/api/__init__.py", line 171, in completions
    self._evaluator, self._get_module(), self._code_lines,
  File "/Users/joeschmoe/dev/ptpython/lib/python2.7/site-packages/jedi/api/__init__.py", line 396, in _get_module
    parser_module = super(Interpreter, self)._get_module_node()
  File "/Users/joeschmoe/dev/ptpython/lib/python2.7/site-packages/jedi/cache.py", line 89, in wrapper
    result = method(self, *args, **kwargs)
  File "/Users/joeschmoe/dev/ptpython/lib/python2.7/site-packages/jedi/api/__init__.py", line 137, in _get_module_node
    parser = FastParser(self._grammar, self._source, self.path)
  File "/Users/joeschmoe/dev/ptpython/lib/python2.7/site-packages/jedi/parser/diff.py", line 33, in __call__
    parser.module = parser._parsed = d.update(new_lines)
  File "/Users/joeschmoe/dev/ptpython/lib/python2.7/site-packages/jedi/parser/diff.py", line 203, in update
    % (last_pos, line_length, ''.join(diff))
Exception: There's an issue (1 != 2) with the diff parser. Please report:

$ pip freeze
appdirs==1.4.0
docopt==0.6.2
jedi==0.10.0
packaging==16.8
prompt-toolkit==1.0.13
ptpython==0.36
Pygments==2.2.0
pyparsing==2.1.10
six==1.10.0
wcwidth==0.1.7

>>> for d in sys.path:
  2     print d

/Users/joeschmoe/dev/ptpython/bin
/Users/joeschmoe
/Users/joeschmoe/dev/ptpython/lib/python27.zip
/Users/joeschmoe/dev/ptpython/lib/python2.7
/Users/joeschmoe/dev/ptpython/lib/python2.7/plat-darwin
/Users/joeschmoe/dev/ptpython/lib/python2.7/plat-mac
/Users/joeschmoe/dev/ptpython/lib/python2.7/plat-mac/lib-scriptpackages
/Users/joeschmoe/dev/ptpython/Extras/lib/python
/Users/joeschmoe/dev/ptpython/lib/python2.7/lib-tk
/Users/joeschmoe/dev/ptpython/lib/python2.7/lib-old
/Users/joeschmoe/dev/ptpython/lib/python2.7/lib-dynload
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages
/Users/joeschmoe/dev/ptpython/lib/python2.7/site-packages

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions