Exiting program

Randall Hopper aa8vb at yahoo.com
Fri Jan 21 10:11:00 EST 2000


volumeregeling:
 |I am making a menubar which uses functions from a cupple of COM
 |objects. I want to exit my program through a stop_program function not
 |from any COM object.
 |
 |def Exit_program():
 |    Editor.mnuFile_Exit()
 |    sys.exit()                        <-- for some reason this also
 |doesn´t work. but that on problem jet.

Keep in mind that this doesn't terminate your program.  It merely raises a
SystemExit exception.  If it is allowed to propagate up past the top level
of your program, the Python interpreter will terminate.  However, it can be
caught and ignored, which is most likely what is going on:

    >>> import sys
    >>> try:
    ...   sys.exit(0)
    ... except:
    ...   print "Request denied"
    ... 
    Request denied
    >>>

-- 
Randall Hopper
aa8vb at yahoo.com




More information about the Python-list mailing list