prompt-toolkit / pyvim

Pure Python Vim clone.
BSD 3-Clause "New" or "Revised" License
2.52k stars 160 forks source link

pyvim not working with python 2.7 #105

Closed ilovezfs closed 6 years ago

ilovezfs commented 6 years ago

Despite py.test passing, pyvim itself fails

Traceback (most recent call last):
  File "/Users/joe/pyvim/v/bin/pyvim", line 11, in <module>
    sys.exit(run())
  File "/Users/joe/pyvim/v/lib/python2.7/site-packages/pyvim/entry_points/run_pyvim.py", line 48, in run
    editor.run()
  File "/Users/joe/pyvim/v/lib/python2.7/site-packages/pyvim/editor.py", line 260, in run
    self.application.run(pre_run=pre_run)
  File "/Users/joe/pyvim/v/lib/python2.7/site-packages/prompt_toolkit/application/application.py", line 682, in run
    return run()
  File "/Users/joe/pyvim/v/lib/python2.7/site-packages/prompt_toolkit/application/application.py", line 656, in run
    return f.result()
  File "/Users/joe/pyvim/v/lib/python2.7/site-packages/prompt_toolkit/eventloop/future.py", line 149, in result
    raise self._exception
AssertionError

Full log

iMac-TMP:~ joe$ mkdir pyvim
iMac-TMP:~ joe$ cd pyvim
iMac-TMP:pyvim joe$ virtualenv -ppython2 v
Running virtualenv with interpreter /usr/local/bin/python2
New python executable in /Users/joe/pyvim/v/bin/python2.7
Also creating executable in /Users/joe/pyvim/v/bin/python
Installing setuptools, pip, wheel...done.
iMac-TMP:pyvim joe$ . v/bin/activate
(v) iMac-TMP:pyvim joe$ git clone https://github.com/jonathanslenders/pyvim.git
Cloning into 'pyvim'...
remote: Counting objects: 651, done.
remote: Compressing objects: 100% (27/27), done.
remote: Total 651 (delta 6), reused 14 (delta 4), pack-reused 620
Receiving objects: 100% (651/651), 718.53 KiB | 345.00 KiB/s, done.
Resolving deltas: 100% (419/419), done.
(v) iMac-TMP:pyvim joe$ cd pyvim/
(v) iMac-TMP:pyvim joe$ git rev-parse @
3f4dcd4111519c1c5b25724b50c0fa2a84479a09
(v) iMac-TMP:pyvim joe$ pip install .
Processing /Users/joe/pyvim/pyvim
Collecting prompt_toolkit<2.1.0,>=2.0.0 (from pyvim==2.0.21)
  Using cached https://files.pythonhosted.org/packages/9b/8c/30b7b8891eb95c791f71256ca5ab134651a92136a2b72c1fd3eb7474249e/prompt_toolkit-2.0.1-py2-none-any.whl
Collecting pyflakes (from pyvim==2.0.21)
  Using cached https://files.pythonhosted.org/packages/44/98/af7a72c9a543b1487d92813c648cb9b9adfbc96faef5455d60f4439aa99b/pyflakes-2.0.0-py2.py3-none-any.whl
Collecting pygments (from pyvim==2.0.21)
  Using cached https://files.pythonhosted.org/packages/02/ee/b6e02dc6529e82b75bb06823ff7d005b141037cb1416b10c6f00fc419dca/Pygments-2.2.0-py2.py3-none-any.whl
Collecting docopt (from pyvim==2.0.21)
Collecting wcwidth (from prompt_toolkit<2.1.0,>=2.0.0->pyvim==2.0.21)
  Using cached https://files.pythonhosted.org/packages/7e/9f/526a6947247599b084ee5232e4f9190a38f398d7300d866af3ab571a5bfe/wcwidth-0.1.7-py2.py3-none-any.whl
Collecting six>=1.9.0 (from prompt_toolkit<2.1.0,>=2.0.0->pyvim==2.0.21)
  Using cached https://files.pythonhosted.org/packages/67/4b/141a581104b1f6397bfa78ac9d43d8ad29a7ca43ea90a2d863fe3056e86a/six-1.11.0-py2.py3-none-any.whl
Building wheels for collected packages: pyvim
  Running setup.py bdist_wheel for pyvim ... done
  Stored in directory: /private/var/folders/w6/9r0nb9011glb8fdz__srd78c0000gq/T/pip-ephem-wheel-cache-h3Uw5K/wheels/a5/d9/42/1e922808a1f5b06ea15fcbe3162e604602053e8ff3dcddf06f
Successfully built pyvim
Installing collected packages: wcwidth, six, prompt-toolkit, pyflakes, pygments, docopt, pyvim
Successfully installed docopt-0.6.2 prompt-toolkit-2.0.1 pyflakes-2.0.0 pygments-2.2.0 pyvim-2.0.21 six-1.11.0 wcwidth-0.1.7
(v) iMac-TMP:pyvim joe$ pip install pytest
Collecting pytest
  Using cached https://files.pythonhosted.org/packages/62/59/950a805f90587d6e2f3692cf43700becb7cdf6c16b06d84e7516b199236b/pytest-3.6.0-py2.py3-none-any.whl
Collecting py>=1.5.0 (from pytest)
  Using cached https://files.pythonhosted.org/packages/67/a5/f77982214dd4c8fd104b066f249adea2c49e25e8703d284382eb5e9ab35a/py-1.5.3-py2.py3-none-any.whl
Requirement already satisfied: six>=1.10.0 in /Users/joe/pyvim/v/lib/python2.7/site-packages (from pytest) (1.11.0)
Collecting pluggy<0.7,>=0.5 (from pytest)
  Using cached https://files.pythonhosted.org/packages/82/05/43e3947125a2137cba4746135c75934ceed1863f27e050fc560052104a71/pluggy-0.6.0-py2-none-any.whl
Collecting funcsigs; python_version < "3.0" (from pytest)
  Using cached https://files.pythonhosted.org/packages/69/cb/f5be453359271714c01b9bd06126eaf2e368f1fddfff30818754b5ac2328/funcsigs-1.0.2-py2.py3-none-any.whl
Collecting atomicwrites>=1.0 (from pytest)
  Using cached https://files.pythonhosted.org/packages/0a/e8/cd6375e7a59664eeea9e1c77a766eeac0fc3083bb958c2b41ec46b95f29c/atomicwrites-1.1.5-py2.py3-none-any.whl
Collecting more-itertools>=4.0.0 (from pytest)
  Using cached https://files.pythonhosted.org/packages/9e/92/d05d8679c3bcaa263169aa47de660080df36d35697855515745657c1ba78/more_itertools-4.2.0-py2-none-any.whl
Requirement already satisfied: setuptools in /Users/joe/pyvim/v/lib/python2.7/site-packages (from pytest) (39.2.0)
Collecting attrs>=17.4.0 (from pytest)
  Using cached https://files.pythonhosted.org/packages/41/59/cedf87e91ed541be7957c501a92102f9cc6363c623a7666d69d51c78ac5b/attrs-18.1.0-py2.py3-none-any.whl
Installing collected packages: py, pluggy, funcsigs, atomicwrites, more-itertools, attrs, pytest
Successfully installed atomicwrites-1.1.5 attrs-18.1.0 funcsigs-1.0.2 more-itertools-4.2.0 pluggy-0.6.0 py-1.5.3 pytest-3.6.0
(v) iMac-TMP:pyvim joe$ cd tests/
(v) iMac-TMP:tests joe$ py.test 
======================================== test session starts ========================================
platform darwin -- Python 2.7.15, pytest-3.6.0, py-1.5.3, pluggy-0.6.0
rootdir: /Users/joe/pyvim/pyvim, inifile:
collected 2 items                                                                                   

test_window_arrangements.py ..                                                                [100%]

===================================== 2 passed in 0.15 seconds ======================================
(v) iMac-TMP:tests joe$ which pyvim
/Users/joe/pyvim/v/bin/pyvim
(v) iMac-TMP:tests joe$ pyvim foo.txt
Traceback (most recent call last):
  File "/Users/joe/pyvim/v/bin/pyvim", line 11, in <module>
    sys.exit(run())
  File "/Users/joe/pyvim/v/lib/python2.7/site-packages/pyvim/entry_points/run_pyvim.py", line 48, in run
    editor.run()
  File "/Users/joe/pyvim/v/lib/python2.7/site-packages/pyvim/editor.py", line 260, in run
    self.application.run(pre_run=pre_run)
  File "/Users/joe/pyvim/v/lib/python2.7/site-packages/prompt_toolkit/application/application.py", line 682, in run
    return run()
  File "/Users/joe/pyvim/v/lib/python2.7/site-packages/prompt_toolkit/application/application.py", line 656, in run
    return f.result()
  File "/Users/joe/pyvim/v/lib/python2.7/site-packages/prompt_toolkit/eventloop/future.py", line 149, in result
    raise self._exception
AssertionError
(v) iMac-TMP:tests joe$ 
jonathanslenders commented 6 years ago

Hi @ilovezfs,

This should fix it: https://github.com/jonathanslenders/python-prompt-toolkit/commit/dc2282d17a9d132e0049545f0ccc2c778b5c3143 Can you try again, after installing the latest prompt_toolkit from master?

It was caused by this line: https://github.com/jonathanslenders/python-prompt-toolkit/blob/master/prompt_toolkit/layout/processors.py#L549

ilovezfs commented 6 years ago

@jonathanslenders yup the fix works :)

ilovezfs commented 6 years ago

This was fixed. Thanks @jonathanslenders