jupyter / jupyter_console

Jupyter Terminal Console

Home Page:http://jupyter-console.readthedocs.io/en/latest/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Keyboard input character error

MNRK01 opened this issue · comments

Hi,

I have an issue that is showing up on ipython and jupyter_console since the 6.1.0 update. I think that what I am seeing is the excessive reflection of character input back to the prompt. I originally opened the issue on the ipython github site but then realized that it should be opened here instead.

ipython/ipython#12119

The issue can be temporarily resolved by downgrading jupyter_console to 6.0.0, although the prompt seems slow but that is better than the alternative.

Can someone please help me figure out what the solution might be?

Thanks.

Hello,

I did some more digging and it appears that the error is coming from conda's upgrade of prompt_toolkit from v. 3.0.2 to 3.0.3. One thing that I hadn't noticed earlier was that the syntax coloring scheme also broke along with the input and output character reflection to the console. Reverting prompt_toolkit back to v. 3.0.2 fixes the issues that I am facing.

Typing "1+2" repeatedly in jupyter_console (v.6.1.0) & prompt_toolkit (v.3.0.3):

C:\Users\USER01>conda.bat activate

(base) C:\Users\USER01>jupyter console --kernel=python
Jupyter console 6.1.0

Python 3.7.6 (default, Jan  8 2020, 20:23:39) [MSC v.1916 64 bit (AMD64)]
Type 'copyright', 'credits' or 'license' for more information
IPython 7.12.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: 1+222
Out[1]: 3

In [2]: 11++222222
Out[2]: 3

In [3]: 111+++222222222
Out[3]: 3

In [4]:

Typing "1+2" repeatedly in jupyter_console (v.6.1.0) & prompt_toolkit (v.3.0.2):

C:\Users\USER01>conda.bat activate

(base) C:\Users\USER01>jupyter console --kernel=python
Jupyter console 6.1.0

C:\Users\USER01\Documents\Data>conda.bat activate & ipython
Python 3.7.6 (default, Jan  8 2020, 20:23:39) [MSC v.1916 64 bit (AMD64)]
Type 'copyright', 'credits' or 'license' for more information
IPython 7.12.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: 1+2
Out[1]: 3

In [2]: 1+2
Out[2]: 3

In [3]: 1+2
Out[3]: 3

In [4]:

I tried to figure out what changes occurred between v. 3.0.2 and 3.0.3 of prompt_toolkit on github, but that's where I am stuck. Any help that you can provide is most appreciated.

Thanks.

I figured out the issue. I had TERM='dumb' in my environment. It was a holdover from way back. This messes up prompt_toolkit >= 3.0.3 which is causing the issue described above. Additionally, it also killed the color scheme for ipython and jupyter_console, something that I noticed after I created this PR.

I looked at the diffs from v. 3.0.2 and v. 3.0.3 of prompt_toolkit and I think that prompt-toolkit/python-prompt-toolkit@61a6eb6 is the one that did it. It has a change that sets cls.DEPTH_1_BIT if TERM=="dumb".

Once I unset the TERM environment variable, everything works well!