Ask your own question, for FREE!
MIT 6.00 Intro Computer Science (OCW) 85 Online
OpenStudy (anonymous):

I realize this isn't supposed to be a tech support forum, but I can't seem to work past this strange problem I'm having and hoping someone can help me out. For the most part, things are going well, but my IDLE seems to be freezing at odd times. I'm using python 2.7.2 on OS X 10.6.8. My problem is when I'm trying to do certain things in IDLE. I write simple code and when I hit f5 or click "run", the entire program (Shell and everything) completely freezes. I do not get an error message and the program does not crash. Anyone know what's going on? I realize this isn't supposed to be a tech support forum, but I can't seem to work past this strange problem I'm having and hoping someone can help me out. For the most part, things are going well, but my IDLE seems to be freezing at odd times. I'm using python 2.7.2 on OS X 10.6.8. My problem is when I'm trying to do certain things in IDLE. I write simple code and when I hit f5 or click "run", the entire program (Shell and everything) completely freezes. I do not get an error message and the program does not crash. Anyone know what's going on? @MIT 6.00 Intro Co…

OpenStudy (anonymous):

It also freezes when I try to use format commands such as "comment out", or any of the other ones.

OpenStudy (anonymous):

does the code work in python shell? If not, here what i would suggest: Instead of launching python through idle , go to dir Python27\Lib\idlelib and right click on idle.py and open with python.exe located in Python27\ . If this doesn't help consider removing python completely then reinstalling.

OpenStudy (anonymous):

First off, thanks for replying! This problem has been driving me up the wall and I can't seem to find a solution. Second, I don't really understand your instructions. I've checked everywhere I could think for the python27 folder you mentioned, but it doesn't seem to exist. In my applications folder I have python 2.7 where idle can be launched from, but that doesn't have an idle.py anywhere. In the library folder from my home directory there is no python folder to speak of.

OpenStudy (anonymous):

That has happened to me before. I was stuck in an infinite loop and didn't realize it. Could that be your problem?

OpenStudy (anonymous):

TexasBread, I don't think so, because the error happens when I use commands such as "comment out", which shouldn't run the program since it's supposed to make the code do nothing and so it shouldn't start an infinite loop.

OpenStudy (anonymous):

Just to test, I just wrote "2+2" and ran the program, which obviously ran without a hitch. I then commented out the "2+2" and the same thing happened. Frozen. Have to force quit. No error message. So weird!

OpenStudy (anonymous):

How are you commenting out the code? Can you post some of your code

OpenStudy (anonymous):

Well, like I said. No matter what the code, it freezes. So let's use 2+2 as an example. I highlight the '2+2', go to Format and choose "Comment out region". Any of the commands in the Format bar cause the program to freeze.

OpenStudy (anonymous):

I'm using Windows, so I'll only be of limited help (if any at all). I've noticed IDLE do the same thing for the professors in the lecture, and they're using Macs, so I don't think you're alone. However it sounds like you're having more trouble than they were. Can you start a terminal window and execute python from the command line? I'm suspecting (for no good reason) that it's an IDLE/python editor problem, and not a python interpreter problem. After that, I'd suggest maybe uninstalling and reinstalling IDLE (or python, I don't know exactly where the boundary between them is, package-wise). If that doesn't work, try an older or newer version to see if that changes anything. Other than that, you'll have to hope for a helpful Mac person to come along.

OpenStudy (anonymous):

Actually, what dmancine wrote might work for the running part of the problem. I sometimes code in a OS X environment, and the IDLE crashed whenever I wanted to run my program, but it works flawlessly if I run it via a terminal window. It even runs with -t / -tt as arguments without doing weird stuff. As for the commenting out problem, have you tried to do a clean reinstall? I actually had problems like that, but then I realized I installed wrongly the Python 2.7 (I installed in the Macintosh HD, iirc, instead of installing in the Applications folder. That caused problems with the pygame lib also) - I mean, even if you installed it correctly in the Apps folder, a fresh reinstall might do the job. I actually hardly use IDLE in a Mac, it's just too bugged. If anything, I would recommend coding in a text editor (textmate, emacs, vim, pick your favorite), and then running via terminal and keeping the IDLE open to test some snippets of code.

OpenStudy (anonymous):

BMP: I just reinstalled Python and I still have the same problem. As for coding in a text editor, how do I do that? Is it a matter of copy/pasting from the text file to terminal? I just tried with textedit and it didn't work that way. Does textedit, the native text editing app on Mac, not work this way?

OpenStudy (anonymous):

You should use a programming text editor (like the ones I cited), because then you would have support for the syntax and stuff like that. Other than that, you should open an empty file in your text editor, then saving it as .py, like foo.py, and then try writing like print 2+2. To run it, open a terminal window, go to the directory that you saved the file(to change directory, use cd /path/directory/), and write "python foo.py", you should see the output of the program if everything went fine. Also, try older version of Python, to see if the IDLE works.

OpenStudy (anonymous):

The error seems to happen no matter which version I use. However, I downloaded textmate and it is working wonderfully. Just ran some simple code from a .py file saved in textmate and ran in terminal. Thanks so much for your help everyone and particularly you, BMP.

OpenStudy (anonymous):

I'm remembering that when I installed something recently it didn't like being installed to a path that contained spaces. I can't remember if it was python or something else. I don't know if the Mac would have the same problem, or if you could control where it gets installed, but it might be the culprit. If you stick with textmate I found this (old) post about using it for python. http://www.libertypages.com/clarktech/?p=192 Specifically you should be able to run your program directly from the editor, without having to switch to the terminal. Might want to check it out when you have some free time.

OpenStudy (anonymous):

Thanks dmancine. This is definitely helpful :).

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!