Pycharm console - input function not working

Completed

I have a small but very annoying problem. Your help would be greatly appreciated.

A simple input() function does not work in PyCharm console..

example code:

Then the console will not take any other input whatsoever, it will always return “>?” no matter what I press. It's as if the console does not recognize the function input(), or it is corrupted somehow?

This only happens in PyCharm console. It works as expected outside of PyCharm and also works as a script in PyCharm.

I just uninstalled/reinstalled PyCharm without success.

I'm running:

  • PyCharm community edition (version 2017.3.2)
  • Python Anaconda3 
  • Windows 10 

Any suggestion on a fix?

Thank you again!

14 comments

Also have this problem, following

0

Today,new release Pycharm fixed this problem,Thank you all!

0

I still have this problem in 2018.2.4, actually never mind, I only have this problem if I am running with the "Emulate terminal in output console" switch enable.

0

Yeah. This is definitely still a problem and causing me pain. I am currently working on a command line style app. I need to have the "Emulate terminal in output console" checked for the output functionality, but then the input functionality doesn't work.

1

Hi Howard,
Could you please clarify what is your project interpreter?

Please upload your logs folder zipped (Help | Show Log in...) after reproducing the problem to 

https://uploads.services.jetbrains.com and let me know the name of that zip file.

0

OK. I created small sample app to verify the issue. The project interpreter is venv directory of the project:

This issue only occurs when "Emulate terminal in output console" is checked:

If I uncheck this or run directly from terminal the input functionality will work. However, calls to isatty() will fail which causes other aspects of my full project not to function.

I have uploaded idea.log to the link you provided.

Thanks,
Howard

0

Thanks!

Could you please provide a sample code and a screenshot showing the problem?

 

0

I get a problem with the sample provided on your "First steps: Creating and Running Your First Python Project. I do everything exactly as instructed, and when I run it and try to enter anything in the console, I get this:

C:\localization\Python\venv\Scripts\python.exe C:/localization/PyCharmProjects/Car/Car.py
I'm a car!
What should I do? [A]ccelerate, [B]rake, show [O]dometer, or show average [S]peed?a
Traceback (most recent call last):
File "C:/localization/PyCharmProjects/Car/Car.py", line 28, in <module>
action = input("What should I do? [A]ccelerate, [B]rake, "
File "<string>", line 1, in <module>
NameError: name 'a' is not defined

Process finished with exit code 1

If I enter the input with quotes, like 'a' then it works. This is a fresh installation, using VirtualEnv Python 3.6, just following the steps in the guide.

0

I was actually able to fix mine. For some reason, even though I created the project as using VirtualEnv 3.6, both the Python Console > Python interpreter and the Project interpreter were set to Python 2.7... After changing those to 3.6, it started working.

0

@Sergey main.py is simply:

command = input("enter a command: ")
print('The command is ' + command)

If I type something at the prompt, I see nothing until I press the enter key:


In this case I have just typed the word 'test' and nothing has appeared on the screen. If I press enter I see:







0

Voted and watched. Thanks Sergey.

0

Please sign in to leave a comment.