IDLE's subprocess didn't make
connection. Either IDLE can't start a
subprocess or personal firewall
software is blocking the connection.
Don't think this has been asked-how come this comes up occasionally when running very simple programs-I then have to go to Task Manager & stop all Pythonw processes to get it to work again?
It seems to happen randomnly on different bits of code-here is the one I'm doing at the moment-
f = open('money.txt')
currentmoney = float(f.readline())
print(currentmoney, end='')
howmuch = (float(input('How much did you put in or take out?:')))
now = currentmoney + howmuch
print(now)
f.close()
f = open('money.txt', 'w')
f.write(str(now))
f.close()
Sometimes it works, sometimes it doesn't!
In Python 3.0.1, I have gotten that error after I Ctrl-C to interrupt a previous run of a program in Idle's Python Shell and then try to run a script.
Also in 3.0.1: Let's say you have two Idle windows open: a script open for editing in one, and Idle's Python Shell window. I have found that if you close the shell window and then immediately try to run the script, it will give that error when it tries to re-open the shell - but not if you wait a bit in between to let Idle do whatever connection clean up it needs to do.
Worse bugs I have found (again, in v3.0.1- not sure if this would happen in the 2.x versions):
I had a long script - getting up towards 9k lines - and once it got to a certain size, doing "save as" on it would crash Idle. I am not sure what the exact threshold was for size - but before that, I would also get some intermittent "save as" crashes that seemed to depend on what else I had going on - other Idle windows, how much output was in the shell window perhaps - stuff like that. It can crash and you will lose unsaved work.
Also - one thing I commonly do is have a scratch window open where I cut and paste bits of code in various stages of validity, write notes to myself, etc - so not a valid python script, but I sometimes save these so I can come back to them. I have one such file that will crash Idle every time I try to open it - and I lost unsaved work the first time. (FYI: Other editors including PythonWin 2.5.2 have no problem opening the file.)
I was getting the same error message. What was causing the problem for me was that I named one of my scripts 'string.py'. Every time I tried to run a script with 'string.py' in the same directory this happened.
You can use idle -n
to avoid such issues (albeit possibly getting some other limitations).
I had this same problem in 2.7.3. I found that when I was learning how to use tkinter and I made a basic program to open a window, I named it Tkinter.py and put it in the same folder as the program I was trying to run with IDLE. It would always compile the program called Tkinter and make a second compiled file. When I tried to run my other program I would get the error message. I renamed my simple windows-opening program to something else and deleted the compiled file. I was able to run every program in that folder with IDLE no problem.
Can you be more specific by providing a short code sample?
IDLE has some threading issues. So the first thing to debug your problem would be to print some simple stuff in your subprocess. Thereby you will see whether it is a network or threading related issue.
Simple. Just cut all files with .py extension, paste them in a place different from the os path, one of the files is causing such error. Run the IDLE again.
If it look like truly random behavior than it could be a multi-cpu/core issue.
You could try to set the interpreter affinity to a fixed cpu and see if this issue still comes up.
Google for something like: imagecfg process affinity
For more information about that.
Or..you could forget IDLE and try IPython instead. It may not exhibit the same error at all. I've never had a problem with it. You get some cool functionality with it that IDLE doesn't have. I find it very useful when working with Python.
i had the same error. I did a modem reboot and to my surprise, it worked !