Ask your own question, for FREE!
Computer Science 15 Online
OpenStudy (anonymous):

I can read the PDF file but I like the look of the lecture code (PY) file as it says "Use the Python interpreter to run .py files" Questions: i) How do you do this? By copying and pasting the code in its entirety into the Python shell of IDLE? ii) I want to practice typing in this code from the lecture but when I type in for example "x = int(raw_input('Enter an integer: '))" it automatically prints "Enter an integer" before I can type in the rest of the code. Why? iii) How do you actually command idle to run the code you have written? Thanks, H

OpenStudy (anonymous):

You are using the Idle shell. It will interpret every command as you enter it. if you want to enter multiple lines then run them you have to use the Idle 'editor' window: Select New from the File menu (in Idle) - the new window will be an editing window - type your code and press F5 to run it - when it asks you to save the file be sure to use the .py extension so that the syntax highlighting will be preserved .... foo.py

OpenStudy (anonymous):

Thanks alot! It works!! So you can type commands in the 'editor' but when it runs the program it is run in IDLE correct? You actually have to save it before you run it. The other quirk is that hitting F5 by itself does not run the program on my Apple MacBook Pro even though under 'Run' in the Editor it says F5. To run it I had to hit the button fn + F5. I just tried to run the program again and it wouldn't work. It is coming up with an error: "IDLE can't bind TCP/IP port 8833......'Running without a subprocess'" Any ideas? Thanks, H

OpenStudy (anonymous):

probably no help for the error especially without the code

OpenStudy (anonymous):

There is a lot of code contained in the error. The error message also says "Run IDLE with the -n command". Python is crashing regularly now.

OpenStudy (anonymous):

what are you trying to do?

OpenStudy (anonymous):

get Python to work!

OpenStudy (anonymous):

Think i will try rebooting...

OpenStudy (anonymous):

I rebooted it and it works ok. Thanks

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!