Xcode Version 6.3.2 (6D2105), can not take input in the console
Question:
I’m a new learner for Python and trying to use Xcode to do it, since Xcode looks clean and nice…
I have Xcode Version 6.3.2 (6D2105), should be the newest one.
I follow this link to set up Python on Xcode. I think I did right, at least if I give a simple command like
print('Hello')
Xcode will return me what I want.
But next when I try
person = input('Enter your name: ')
print('Hello', person)
I see my “Enter your name” shows up in the console.(Lower right box). However, if I put my mouse cursor on it and start typing the cursor doesn’t move, and my keystrokes don’t show up. But I can see the blinking there so it must have the focus but just not take any input.
I try to search on the web and see some similar post. But they are very old and have no answer.
It shouldn’t be a big bug I hope… Can anybody help me to solve this problem?
Thank you!
Answers:
According to this the XCode Debugger/Console only allows interaction for programs written in C, C++ and C-Objective.
So I would recommend switching to a different IDE.
Update for Xcode 13 and c++ although the same solution may apply to python as the original poser was asking about…
In Product > Scheme > Edit Scheme
Make sure you check ‘Debug Executable’.
I found that the console would appear, along with all the correct output (std::cout) and the blinking cursor, but it would not accept input.
I’m a new learner for Python and trying to use Xcode to do it, since Xcode looks clean and nice…
I have Xcode Version 6.3.2 (6D2105), should be the newest one.
I follow this link to set up Python on Xcode. I think I did right, at least if I give a simple command like
print('Hello')
Xcode will return me what I want.
But next when I try
person = input('Enter your name: ')
print('Hello', person)
I see my “Enter your name” shows up in the console.(Lower right box). However, if I put my mouse cursor on it and start typing the cursor doesn’t move, and my keystrokes don’t show up. But I can see the blinking there so it must have the focus but just not take any input.
I try to search on the web and see some similar post. But they are very old and have no answer.
It shouldn’t be a big bug I hope… Can anybody help me to solve this problem?
Thank you!
According to this the XCode Debugger/Console only allows interaction for programs written in C, C++ and C-Objective.
So I would recommend switching to a different IDE.
Update for Xcode 13 and c++ although the same solution may apply to python as the original poser was asking about…
In Product > Scheme > Edit Scheme
Make sure you check ‘Debug Executable’.
I found that the console would appear, along with all the correct output (std::cout) and the blinking cursor, but it would not accept input.