I've recently started learning python and got tired of running it on the command line (terminal mac os x). I wanted an environment that I could code nicely in and run that code only when pieces of it were done, not line-by-line as in the shell. I decided to use Xcode as the interface is clean and simple, and followed this tutorial to set up Xcode so that I could run python scripts.
My problem is that when I use raw_input() and then click run, I can't type a value to pass to the variable it's stored in. Take this simple line for example:
word = raw_input("Enter a word: ")
Later on in the program, word is printed. When I click run on Xcode, the prompt shows up as expected in the console:
Enter a word:
However, I can not type anything into it, the cursor is blinking so I know it is responding but when I type a value, nothing happens. I'm not sure what is wrong here, hopefully one of you can help me out.
解决方案
If you really want to use an IDE for Python development, go for Aptana Studio 3 .
Once you are done with Pydev setup which is very easy Refer this for Pydev Setup.
Before running a script which expects some command line inputs you can click on the small arrow button adjacent to run button, it will give you a drop down menu with different options. Click on run configurations and then click on a tab named Arguments and enter your parameters there in the field names Program Arguments. Click on apply and you are good to go.
Next time you need to run the code just click on run and it will automatically fetch arguments that you have specified in the option above.
Hope this help.