Search code examples
ubuntupycharmpython-3.10

input 2 integers and getting erorr in pycharm ubuntu


So when i press "Run" and manually input the 2 integers , i get this error down below. I've tried via terminal ,debug and "Run File in Python Console" and it's working fine. I'm running on Ubuntu via VMware. Python version 3.10.4. My code:

a = int(input())
b = int(input())
print(a*b)

Input:

>?2
>?7

Output:

Traceback (most recent call last):
  File "/home/inzein/PycharmProjects/UbuntuTest/test.py", line 2, in <module>
    b = int(input())
ValueError: invalid literal for int() with base 10: ''

Solution

  • Regression in 2022.1.1 PyCharm, ticket https://youtrack.jetbrains.com/issue/PY-54238/STDIN-is-lost-for-a-second-input-call

    Will be fixed in 2022.1.2 (Release Candidate next week) and 2022.2.

    If you want to downgrade the old PyCharm versions archive is here https://www.jetbrains.com/pycharm/download/other.html