Help - Search - Members - Calendar
Full Version: Problem In Python
BleepingComputer.com > Software > Programming
   
Piotr-Seeler
Hello.. i was just doing a program on python ( on Idle more precisely ) and i saved it as a .py file.
When i run it from the windows explorer it quickly exits unless i add to the end of the code : "raw_input("press enter to exit")

anybody knows what to do?

Thank you smile.gif
groovicus
Does anybody know what to do to accomplish what exactly?
Piotr-Seeler
ok... when i open the file from the folder it is contained... the program runs.
However.. the command prompt thus opened quickly closes without giving me the time to even read what was going on.

Is it clearer ?
groovicus
So the question is, how do I get the command window to stay open so that I can see the results?

Easy. Open a command window, and run the file from the command line,
or 2, have the application pause while it waits for input (which you already did),
or 3, have the application pause for a set amount of time.
Piotr-Seeler
yes you got it right smile.gif

ok for 2.
for the first one... you mean that i open cmd?
for 3.. and how do i let it pause for a set amount of time?
groovicus
QUOTE
you mean that i open cmd?

Yes.

QUOTE
and how do i let it pause for a set amount of time?

I have no idea what the syntax is in Python, but according to Google, Python has a sleep function.

Piotr-Seeler
ok thank you for your answers smile.gif
Piotr-Seeler
i found it... u must import time. then use time.sleep(n)
n = number of seconds you wish to give.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.