Input function leaves newline before prompt
See original GitHub issueDescription
The version of Spyder/IPython I’m using is as follows (this is the startup prompt in the console): Python 3.6.3 |Anaconda, Inc.| (default, Oct 15 2017, 03:27:45) [MSC v.1900 64 bit (AMD64)] Type “copyright”, “credits” or “license” for more information.
IPython 6.1.0 – An enhanced Interactive Python.
More version info below.
The problem I’m having is that when I try to use the input function, the console within spyder – whether I use the existing or new console – will display a blank line above where the input prompt is. This problem does not occur when I use an external console to display output/take input.
Note: I have already left this, nearly identical, report with the people at spyder. This was their response : “Thanks for the detailed report. Not sure the reasons behind this exact behavior (its possible its unintentional or not easily avoidable), but in any case it isn’t an issue with Spyder’s code, but rather qtconsole (as I reproduced it in plain qtconsole running separate from Spyder, but not IPython running in a standard terminal). Therefore, you’ll want to submit an issue over there, and I’ll close this one. Best of luck!”
What steps will reproduce the problem?
- Open the version of spyder/IPython listed above
- Input code including an input function without any newline characters above it or in the prompt. The test code I used was:
def test():
print(1)
print(2)
input('Number: ')
print(4)
test()
- Run the code
What is the expected output? What do you see instead? I expect to see (if my input is 3): 1 2 Number: 3 4
What I see instead is: 1 2
Number: 3 4
Please provide any additional information below Please tell me if there is anything more you need to see.
Version and main components
- Spyder Version: 3.2.4
- Python Version: 3.6.3
- Qt Versions: 5.6.2, PyQt5 5.6 on Windows
Dependencies
pyflakes >=0.6.0 : 1.6.0 (OK)
pycodestyle >=2.3: 2.3.1 (OK)
pygments >=2.0 : 2.2.0 (OK)
pandas >=0.13.1 : 0.20.3 (OK)
numpy >=1.7 : 1.13.3 (OK)
sphinx >=0.6.6 : 1.6.3 (OK)
rope >=0.9.4 : 0.10.5 (OK)
jedi >=0.9.0 : 0.10.2 (OK)
nbconvert >=4.0 : 5.3.1 (OK)
sympy >=0.7.3 : 1.1.1 (OK)
cython >=0.21 : 0.26.1 (OK)
qtconsole >=4.2.0: 4.3.1 (OK)
IPython >=4.0 : 6.1.0 (OK)
pylint >=0.25 : 1.7.4 (OK)
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:6 (1 by maintainers)
Top GitHub Comments
check this : https://docs.python.org/3/library/functions.html#input
It says : input([prompt]) If the prompt argument is present, it is written to standard output without a trailing newline.
In your case there is no prompt , hence the trailing newline !
I have a fix for this but I need to see how to integrate with Spyder.