Click here to Skip to main content
15,357,293 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
this is my code

a = input()
b = input()



this is my debug windows (OK)
C:\PycharmProjects\venv\Scripts\python.exe "C:\Program Files\JetBrains\PyCharm Community Edition 2022.1.1\plugins\python-ce\helpers\pydev\" --multiprocess --qt-support=auto --client --port 50151 --file C:/PycharmProjects/
Connected to pydev debugger (build 221.5591.52)

Process finished with exit code 0

this is my run window (NG)
C:\PycharmProjects\venv\Scripts\python.exe C:/PycharmProjects/
Traceback (most recent call last):
  File "C:\PycharmProjects\", line 5, in <module>
ValueError: invalid literal for int() with base 10: ''

Process finished with exit code 1


What I have tried:

please help me..
please help me..
please help me..
Updated 30-May-22 4:20am
Richard MacCutchan 27-May-22 12:47pm
According to the error message b does not contain a valid number. Check that you are running the correct code.
Member 14007122 27-May-22 12:49pm
Hi Richard.
I just input 5(enter)10
10 is not valid number right..?

Why debug window is OK but not Run window is NG..?
input is the same..
Richard MacCutchan 28-May-22 3:42am
Yes, 10 is a valid number. I copied your code and it runs fine, in fact I cannot get it to fail.
Member 14007122 28-May-22 3:56am
You just input 5(enter)10 right?
I input the same, but why my code occur error?
is any possible occur error except for my code?
thanks for your help in advance..!
Richard MacCutchan 28-May-22 4:00am
Yes, exactly like that. However, if I type 5 (enter) (enter) it produces the error you see. So that is the only thing I can see as a possibility.
CHill60 30-May-22 7:19am
Have you sorted this out now?
Member 14007122 30-May-22 7:26am
Not yet..

1 solution

Both @Richard-MacCutchan and I have run your code "as-is" and it does not produce any error.

Which means the problem must lie with your inputs. If you look at the error message carefully, the runtime thinks that the value input for b is a blank string
ValueError: invalid literal for int() with base 10: ''
So it seems the difference between your debug environment and runtime environment is how it is interpreting the CRLF between your inputs OR you are hitting enter twice after entering each of the values (this was the only way I could get it to fail)

There was a bug some time back where the input() function put an extra '\r' character onto the input, that would possibly have this effect. To see if that is what is happening try changing your code to the following to see what comes out between the !! characters
a = input()
b = input()

print("!" + a + "!")
print("!" + b + "!")
If it comes out like below then you have that bug

That bug has now been fixed, so make sure you have the most recent version of Python.

Edit: Or you could use an alternative method of getting the data - e.g. raw_input()

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900