Invalid input when pasting any text with newline in PyCharm console

Consider this simple function:

def test():
    x = int(input())
    y = int(input())
    print(x, y)
test()

Run above with PyCharm's python console, it'll ask for input,
paste below input in pycharm console

1
2

Error:

x = int(input())
ValueError: invalid literal for int() with base 10: '1\n2'

It should print: 1 2

This happens with both "python console" and "IPython console" inside PyCharm

Note that this works perfectly from system terminal/command prompt or IDLE and prints: 1 2

Using PyCharm Community 2020.3.

 

3 comments
Comment actions Permalink

Just tried without typecast:

def test():
x = input()
y = input()
print('>>>', x, y)
test()

It's not working as desired if I paste 

1
2

0
Comment actions Permalink

Hi, 

You can report bugs in our issue tracker https://youtrack.jetbrains.com/issues/py

0

Please sign in to leave a comment.