"Closing" a script...

Please support our Python advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved

Join Date: Jul 2005
Posts: 68
Reputation: danizzil14 is an unknown quantity at this point 
Solved Threads: 1
danizzil14's Avatar
danizzil14 danizzil14 is offline Offline
Junior Poster in Training

"Closing" a script...

 
0
  #1
Feb 11th, 2007
Ok, all I want ot know is how to close a script on command, lie type 3 to exit, what modules do i need to import and what is the command, I have everything else sorted out...

EDIT: The close command will go in a if statement, which is in a function.

EDIT2: Never mind, problem solved, go ahead and close or delete this topic admins...
Last edited by danizzil14; Feb 11th, 2007 at 7:11 pm.
Blender is by far the best free 3D computer Graphics program and it is expandable with python! GoTo www.blender3d.org
Reply With Quote Quick reply to this message  
Join Date: Oct 2004
Posts: 4,139
Reputation: vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice 
Solved Threads: 946
Moderator
vegaseat's Avatar
vegaseat vegaseat is online now Online
DaniWeb's Hypocrite

Re: "Closing" a script...

 
0
  #2
Feb 12th, 2007
Just in case others are interested, to exit a program use ...
  1. import sys
  2. sys.exit()
or easier ...
  1. raise SystemExit
May 'the Google' be with you!
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 2,564
Reputation: mattyd is an unknown quantity at this point 
Solved Threads: 1
Featured Poster
mattyd's Avatar
mattyd mattyd is offline Offline
Posting Maven

Re: "Closing" a script...

 
0
  #3
Feb 12th, 2007
Originally Posted by vegaseat View Post
Just in case others are interested, to exit a program use ...
  1. import sys
  2. sys.exit()
or easier ...
  1. raise SystemExit
Yes, quite interesting, actually-- I was just wondering about this; I searched via google for sys.exit() to gather some more info and found a lot of scattered information that told me either too little or to much. It seems this way with Python docs\tutorials\etc on the Net IMO.

I come to <Daniweb> and search and... here some vital information is. (as usual )

vegaseat: can you elaborate on why using SystemExit is "easier"
just so I can understand it better. I just used it-- worked just fine.


Thanks a lot,
Matty
Reply With Quote Quick reply to this message  
Join Date: Apr 2006
Posts: 150
Reputation: ghostdog74 is on a distinguished road 
Solved Threads: 40
ghostdog74 ghostdog74 is offline Offline
Junior Poster

Re: "Closing" a script...

 
0
  #4
Feb 12th, 2007
sys.exit() implements SystemExit, see
http://docs.python.org/lib/module-sys.html
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Python Forum


Views: 1376 | Replies: 3
Thread Tools Search this Thread



Tag cloud for Python
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC