473,705 Members | 4,203 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

Hi all, I am very new to programming, and I chose to study the Python
language before C++. I am currently using the Wikibooks
"Non-Programmer's Tutorial for Python", and am up to the section "Who
goes there"?

http://en.wikibooks.org/wiki/Non-Pro..._Goes_There%3F

But after clicking "run module" for
"
a = 1
print a
a = a + 1
print a
a = a * 2
print a "

The results "1, 2, 4" didn't appear on the GUI screen, in fact nothing
did. And I clicked twice again, this time, it exited the Python GUI
program. I tried to enter back in, but it would quickly display

"1
2
4"

before exiting immediately within half a second. How do I stop the this
exiting from occurring.

Another problem I have is firewall. On my old computer (Windows 98)
when using Python GUI, it can't run modules because of some firewall.
But I thought firewalls were for internet sites only?! How do I fix
this??

Thank you in advance, and I apologize for my ignorance.

Nov 19 '06 #1
6 5249
John (Z R) L wrote:
But after clicking "run module"
Being new is never problem, but do learn to provide concise, complete
descriptions of exactly what happened and what you were doing at the
time.

Are you in IDLE? Or are you in PythonWin? OR did you make a script
file and try to run it by double clicking on it?

Sounds like you were creating a script file, then tried to run it?
Search this list at Google Groups comp.lang.pytho n for "keep DOS box
open."

http://tinyurl.com/wh7fy
Another problem I have is firewall. On my old computer (Windows 98)
when using Python GUI, it can't run modules because of some firewall.
Please enter the exact error message you get. It's probably some
officious Windows security glitch, but nobody can help you until you
provide the messages you get.

Windows 98? Linux would run twice as fast on any machine old enough to
run Windows 98, and your Python would work better, too.

Good luck,

rd

Nov 19 '06 #2
Am Sat, 18 Nov 2006 23:24:08 -0800 schrieb John (Z R) L:
Hi all, I am very new to programming, and I chose to study the Python
language before C++. I am currently using the Wikibooks
"Non-Programmer's Tutorial for Python", and am up to the section "Who
goes there"?

http://en.wikibooks.org/wiki/Non-Pro..._Goes_There%3F

But after clicking "run module" for
"
a = 1
print a
a = a + 1
print a
a = a * 2
print a "

The results "1, 2, 4" didn't appear on the GUI screen, in fact nothing
did. And I clicked twice again, this time, it exited the Python GUI
program. I tried to enter back in, but it would quickly display

"1
2
4"

before exiting immediately within half a second. How do I stop the this
exiting from occurring.
All of this using IDLE as your GUI (not PythonWin and not the python
interpreter by itself), right?

You did all this as explained at the start of the tutorial: open a "New
window", type the code into this empty window, save it to a reasonable
place and then click "Run / Run module". Right? (Silly question: there is
no run menu in the interactive window. On the other hand, you never know.)

What about the examples before this one, did you type, save and run them
just like this one? And did they work as you expected?

What version of Python and of IDLE do you use?

If you have PythonWin (it's part of ActiveState Python, for example): what
happens, if you run your script using that? What happens if you open a
command window, go to the right directory and run your script from there?
(Don't try to start it by double clicking in the explorer: it will run,
but the window will close immediately afterwards, and you won't see
anything.)
Another problem I have is firewall. On my old computer (Windows 98)
when using Python GUI, it can't run modules because of some firewall.
But I thought firewalls were for internet sites only?! How do I fix
this??
Do you mean this?

*************** *************** *************** *************** ****
Personal firewall software may warn about the connection IDLE
makes to its subprocess using this computer's internal loopback
interface. This connection is not visible on any external
interface and no data is sent to or received from the Internet.
*************** *************** *************** *************** ****

This shouldn't keep any script from running. What exactly happens if you
try?
Nov 19 '06 #3
Thanks for the replies so far. I do exactly what that website says, and
on the old computer (Windows 98), I click run module and nothing
happens. No text gets displayed on my IDLE. It contained that firewall
message at the top.

Back on the new computer, I deleted all of my .py files and I could go
back to the Python IDLE (GUI) again.

But my problem is with that when I run this module:
"a = 1
print a
a = a + 1
print a
a = a * 2
print a" ,

the "1
2
4"
appears on the screen, but the program doesn't end. You don't get a new
">>>" like when you finish running all the other modules. So when I
want to run other modules, it says:
"The Python Shell Window is already executing a command; please wait
until it is finished."

Note that all of my modules don't need any "end" at the last line, nor
do I need "raw_input" to end the program.

How do I make it so this module ends without using the word "end"
because it would exit the entire IDLE Shell?

Nov 19 '06 #4
Am Sun, 19 Nov 2006 14:32:45 -0800 schrieb John (Z R) L:
Thanks for the replies so far. I do exactly what that website says, and
on the old computer (Windows 98), I click run module and nothing
happens. No text gets displayed on my IDLE. It contained that firewall
message at the top.

Back on the new computer, I deleted all of my .py files and I could go
back to the Python IDLE (GUI) again.
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.

Nov 20 '06 #5
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.

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

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.. .

Nov 20 '06 #6
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.

Nov 21 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
2245
by: Aubrey Hutchison | last post by:
Using Python 2,3,2 with idle for developing programs about 200 lines long. - Problem is not common to any specific program. Program are rather simple with no trick programming. Usually no classes but a few functions using math module with long integers. Usually for the first few tryout everything works fine and then idle locks "out" windows xp pro.. I can run other programs, but clicking on idle icon gets me an hour glass for a few...
15
7383
by: Ashot | last post by:
This is sort of both Python and Vim related (which is why I've posted to both newsgroups). Python related: ---------------------- I have been frustrated for quite some time with a lack of a history command in IDLE (in fact with IDLE in general). Often I'll develop new code at the command line, testing each line as I go. Currently I have to copy and paste, removing outputs and the ">>>" at each line. Is it perhaps possible to make...
30
2904
by: bblais | last post by:
Hello, Let me start by saying that I am coming from a background using Matlab (or Octave), and C++. I am going to outline the basic nuts-and-bolts of how I work in these languages, and ask for some help to find out how the same thing is done in Python. I am not sure what the standard is. In C++, I open up an editor in one window, a Unix shell in another. I write the code in the editor, then switch to the shell window for compile...
0
281
by: Kurt B. Kaiser | last post by:
Patch / Bug Summary ___________________ Patches : 422 open ( +2) / 3415 closed ( +5) / 3837 total ( +7) Bugs : 933 open (+18) / 6212 closed (+26) / 7145 total (+44) RFE : 237 open ( +2) / 239 closed ( +1) / 476 total ( +3) New / Reopened Patches ______________________
6
15031
by: Alan Isaac | last post by:
I'm fairly new to Python and I've lately been running a script at the interpreter while working on it. Sometimes I only want to run the first quarter or half etc. What is the "good" way to do this? Possible ugly hacks include: - stick an undefined name at the desired stop point - comment out the last half I do not like these and assume that I have overlooked the obvious.
12
3009
by: adamurbas | last post by:
ya so im pretty much a newb to this whole python thing... its pretty cool but i just started today and im already having trouble. i started to use a tutorial that i found somewhere and i followed the instructions and couldnt get the correct results. heres the code stuff... temperature=input("what is the temperature of the spam?") if temperature>50: print "the salad is properly cooked." else:
5
1446
by: mac_the_scotte | last post by:
Hi there. I downloaded python a couple of days ago from the official site and have started writing simple programs in the python gui (this being my first attempt at programming ever). The only thing is when I write python code in a text editor and save it as a .py file, when I double click it all that happens is a black box flashes up on the screen, but nothing else!? At first I thought this was because I had only written a hello world...
1
5773
by: anonymous | last post by:
1 Objective to write little programs to help me learn German. See code after numbered comments. //Thanks in advance for any direction or suggestions. tk 2 Want keyboard answer input, for example: answer_str = raw_input(' Enter answer ') Herr ‹Ł
7
1797
by: Anthony | last post by:
Hi, I'm a FoxPro programmer, but I want to learn python before it's too late. I do a lot of statistical programming, so I import SPSS into python. In my opinion, the best features of Visual FoxPro 9.0 were: a) Intellisense (tells you what classes/methods are available and what variables go into a function) b) Code Completion (guesses your code after four letters) c) Data-Orientation; multiple data sessions can be open, data can be...
0
8768
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, weíll explore What is ONU, What Is Router, ONU & Routerís main usage, and What is the difference between ONU and Router. Letís take a closer look ! Part I. Meaning of...
0
9274
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9139
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9034
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8979
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6606
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Duprť who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4704
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3138
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2083
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.