How do I stop Python IDLE (GUI) from immediately exiting when I enter it?

Hertha Steck nulla.epistola at web.de
Tue Nov 21 14:17:50 EST 2006


Am Mon, 20 Nov 2006 12:11:32 -0800 schrieb John (Z R) L:

>> First of all: did you try to run the script using PythonWin and did you
>> run it in a command window? What happened? What error messages did you
>> get, if any?
>>
>> The script itself doesn't contain any errors. And in my IDLE it behaves
>> perfectly well.
>>
>> And please, if you answer, keep the text you are answering. This is no web
>> forum where you can see several postings at once.
> 
> The script is running perfectly fine now for some strange reason?? But
> previously it wasn't.
> 
> I always type my script in a new Window of the IDLE interface, and when
> I do "Run Module", the output appears in the main Python Shell (IDLE).
> 
> When I tried to run the script, "1,2,4" would appear, but the new
> prompt (>>>) DOESN'T appear. So when I want to run other modules that I
> made, Python Shell will say something like "Can't run script, in the
> middle of another module process.".
> 
> So I have to exit the Python Shell, and then it says "You are currently
> running a module, kill it?". I click "Yes", but when I reenter the
> program, "1,2,4" suddenly appear on the output, then the program
> immediately exits within half a second.
> 

All this looks like a script with an endless loop in it. But in the code
you posted there is no loop at all.

> I solve this by deleting the .py and .pyc file which it keeps on
> displaying, and the Python IDLE gets reset.
> 

Then I suppose you typed the script again from scratch? Possibly you had
some error in it that didn't show in your posting. But I don't think that
can be cleared up now.

> I don't have to delete stuff anymore because the scripts are running
> fine now. But I'm worried that this error will happen again
> (randomly?!), and I'll be in for more inconvenience...

If that happens: try your script in the command window. And if at all
possible, look at it in a hex viewer to find not printable characters that
might corrupt the file. And post again, but be sure to cut and paste your
code.




More information about the Python-list mailing list