944,110 Members | Top Members by Rank

Ad:
  • Python Discussion Thread
  • Marked Solved
  • Views: 2451
  • Python RSS
Feb 11th, 2007
0

"Closing" a script...

Expand Post »
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.
Similar Threads
Reputation Points: 16
Solved Threads: 1
Junior Poster in Training
danizzil14 is offline Offline
68 posts
since Jul 2005
Feb 12th, 2007
0

Re: "Closing" a script...

Just in case others are interested, to exit a program use ...
Python Syntax (Toggle Plain Text)
  1. import sys
  2. sys.exit()
or easier ...
Python Syntax (Toggle Plain Text)
  1. raise SystemExit
Moderator
Reputation Points: 1333
Solved Threads: 1404
DaniWeb's Hypocrite
vegaseat is offline Offline
5,792 posts
since Oct 2004
Feb 12th, 2007
0

Re: "Closing" a script...

Click to Expand / Collapse  Quote originally posted by vegaseat ...
Just in case others are interested, to exit a program use ...
Python Syntax (Toggle Plain Text)
  1. import sys
  2. sys.exit()
or easier ...
Python Syntax (Toggle Plain Text)
  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
Featured Poster
Reputation Points: 105
Solved Threads: 1
Posting Maven
mattyd is offline Offline
2,582 posts
since Oct 2006
Feb 12th, 2007
0

Re: "Closing" a script...

sys.exit() implements SystemExit, see
http://docs.python.org/lib/module-sys.html
Reputation Points: 75
Solved Threads: 44
Junior Poster
ghostdog74 is offline Offline
156 posts
since Apr 2006

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Python Forum Timeline: Tkinter Button "Disable" ?
Next Thread in Python Forum Timeline: Problems with my game...





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC