1

I am using Python's raw_input to get input from keyboard.

How do I debug my code with PyCharm? I am unable to input from keyboard when (for example) name = raw_input("Input your name") is executed.

Danijel
  • 8,198
  • 18
  • 69
  • 133

2 Answers2

3

You enter the input into the console that shows up, when you compile and run your script. Like so, the green text is the input.

enter image description here

cyberbemon
  • 3,000
  • 11
  • 37
  • 62
  • 5
    The problem was `PyCharm->Properties->Build->Console>"Always show debug console"` which was checked, so Python console was taking my input. I de-selected the console checkbox, and now I can do what you suggest on the screenshot. Thanks. – Danijel Feb 24 '16 at 14:48
  • Another problem: now `key = msvcrt.getch()` doesn't work in PyCharm, but that seems to be known problem: http://stackoverflow.com/questions/30534218/msvcrt-kbhit-and-msvcrt-getch-not-working-in-pycharm. – Danijel Feb 24 '16 at 14:58
  • It seems you also want to be sure to **not** check the Run Configurations option "Emulate terminal in output console, which seems odd. You may also have problems with `getpass.getpass()`, I can only get it working in debug mode: see https://stackoverflow.com/questions/28579468/how-to-use-the-python-getpass-getpass-in-pycharm – nealmcb Nov 04 '17 at 21:40
0

For users of IntelliJ, "Always show debug console" is under IntelliJ IDEA -> Settings -> Build, Execution, Deployment -> Console