Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

Problem In Python


  • Please log in to reply
7 replies to this topic

#1 Piotr-Seeler

Piotr-Seeler

  • Members
  • 26 posts
  • OFFLINE
  •  
  • Local time:08:50 AM

Posted 21 August 2008 - 05:12 PM

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 :thumbsup:

BC AdBot (Login to Remove)

 


#2 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:10:50 PM

Posted 21 August 2008 - 05:29 PM

Does anybody know what to do to accomplish what exactly?

#3 Piotr-Seeler

Piotr-Seeler
  • Topic Starter

  • Members
  • 26 posts
  • OFFLINE
  •  
  • Local time:08:50 AM

Posted 21 August 2008 - 06:03 PM

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 ?

#4 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:10:50 PM

Posted 21 August 2008 - 06:23 PM

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.

#5 Piotr-Seeler

Piotr-Seeler
  • Topic Starter

  • Members
  • 26 posts
  • OFFLINE
  •  
  • Local time:08:50 AM

Posted 21 August 2008 - 06:30 PM

yes you got it right :thumbsup:

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?

#6 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:10:50 PM

Posted 21 August 2008 - 07:18 PM

you mean that i open cmd?

Yes.

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.

#7 Piotr-Seeler

Piotr-Seeler
  • Topic Starter

  • Members
  • 26 posts
  • OFFLINE
  •  
  • Local time:08:50 AM

Posted 24 August 2008 - 08:55 AM

ok thank you for your answers :thumbsup:

#8 Piotr-Seeler

Piotr-Seeler
  • Topic Starter

  • Members
  • 26 posts
  • OFFLINE
  •  
  • Local time:08:50 AM

Posted 25 August 2008 - 04:48 PM

i found it... u must import time. then use time.sleep(n)
n = number of seconds you wish to give.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users