EOFError in input function

Asked 2 years ago, Updated 2 years ago, 80 views

I am troubled because I do not understand the meaning of Python error message.
I'm sorry to ask you a beginner's question, but please help me.

input function of the program chap2.py 「Please enter: 」 and you will see the following in the terminal:

Please enter: I want to quit now
Traceback (most recent call last):
  File "chap2.py", line 2, in <module>
    US>parrot=input("Please enter:")
EOFError

In Python 3.7.3, you entered:

parrot=input("Please enter:")
print(parrot)
)

I changed the terminal character code to utf-8 because it was garbled by default.
Active code page: 65001

In Edit in setting json of terminal integrated shell args windows, we added the following code:

"terminal.integrated.shellArgs.windows":[
"- NoExit",
"chcp",
"65001"
],

I started the command prompt from the folder and tried it, but I got a similar error message.

I'm in a lot of trouble.Thank you very much for your instruction.

  • Windows 7

python python3 visual-studio

2022-09-30 21:39

1 Answers

I will reprint it because it seems to have been resolved in a multi-post destination.

I installed python 3.X and wrote the program accordingly.
The previously installed pyothon 2.7 was recognized by the VSC, and the 3.X program failed because it was running at 2.7.
Uninstalling pyothon 2.7 resolved.

VS VSC = Visual Studio Code


2022-09-30 21:39

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.