Self terminate a python program

Discussion in 'Python' started by Ernesto, Nov 15, 2005.

  1. Ernesto

    Ernesto Guest

    how do you self terminate a python program from within the code?

    something similar to exit(0) in C.

    I think the problem is that I'm using subprocess and popen to launch a
    '.exe' file and python is "waiting" on the .exe file to finish. since
    it never does, the python program won't end. how can I force it to end?
     
    Ernesto, Nov 15, 2005
    #1
    1. Advertising

  2. Ernesto

    Ben Finney Guest

    Ernesto <> wrote:
    > how do you self terminate a python program from within the code?
    > something similar to exit(0) in C.


    Inspection and control of the Python runtime system is mostly within
    the 'sys' module.

    <URL:http://docs.python.org/lib/module-sys.html>

    In this case, 'import sys; help(sys.exit)' will be of assistance.

    --
    \ "I always had a repulsive need to be something more than |
    `\ human." -- David Bowie |
    _o__) |
    Ben Finney
     
    Ben Finney, Nov 15, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ralf W. Grosse-Kunstleve
    Replies:
    16
    Views:
    595
    Lonnie Princehouse
    Jul 11, 2005
  2. Ralf W. Grosse-Kunstleve
    Replies:
    18
    Views:
    602
    Bengt Richter
    Jul 11, 2005
  3. Ralf W. Grosse-Kunstleve
    Replies:
    2
    Views:
    409
    Dan Sommers
    Jul 12, 2005
  4. falcon
    Replies:
    0
    Views:
    381
    falcon
    Jul 31, 2005
  5. Bart Kastermans
    Replies:
    6
    Views:
    409
    Bart Kastermans
    Jul 13, 2008
Loading...

Share This Page