Ваше заявление о невозможности ввода в эмулируемую консоль неверно. Вы ввели строки, которые не являются допустимыми аргументами для input
. Сообщения об ошибках верны. Они такие же, как когда вы вводите то же самое непосредственно в интерактив python.
Python 3.9.0a3+ (heads/master:46874c26ee, Jan 30 2020, 20:04:52) [MSC v.1900 32
bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> s = int(input('Enter number: '))
Enter number:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: invalid literal for int() with base 10: ''
>>> s = int(input('Enter number: '))
Enter number: xxxx
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: invalid literal for int() with base 10: 'xxxx'
Они также такие же, как когда вы запускаете тот же код из файла. input
возвращает строку. Перечитайте часть int do c о строковых аргументах.
If x is not a number or if base is given, then x must be a string,
bytes, or bytearray instance representing an integer literal in the
given base. The literal can be preceded by '+' or '-' and be surrounded
by whitespace. The base defaults to 10. Valid bases are 0 and 2-36.
Base 0 means to interpret the base from the string as an integer literal.
>>> int('0b100', base=0)
4
Ни '', ни 'ssss' не представляют строковые литералы в базе 10.