Matheus
Matheus

Reputation: 3370

Inexplicable ValueError in Pycharm with Python 3.10.4

First and foremost: I'm using Ubuntu 22.04 and Python 3.10.4.

Suddenly my PyCharm IDE is showing me a inexplicable ValueError when I run the script.

A code as simple as bellow return a value error on line 2

a = int(input())
b = int(input())
print(f'{a + b}')

My input:

1
1

The error:

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

Funny enough, if I type anything inside the input() function at line 2, the code works:

a = int(input())
b = int(input("Second number: "))
print(f'{a + b}')

Result:

1
Second number: 1
2

Process finished with exit code 0

Video of the actual behavior:

behavior

Can someone explain what is going on here?

Upvotes: 2

Views: 307

Answers (1)

Pavel Karateev
Pavel Karateev

Reputation: 8495

Tldr update to 2022.1.2 where PyCharm bug was fixed.

Upvotes: 2

Related Questions