Sys.exit() does not fully exit

Harlin Seritt harlinseritt at yahoo.com
Sun Feb 17 15:15:03 CET 2008


I have this script:

import os, thread, threading, time, sys

class Script1(threading.Thread):
    def run(self):
        os.system('runScript1.py')

class Script2(threading.Thread):
    def run(self):
        os.system('runScript2.py')

if __name__ == '__main__':

    s = Script1()
    s.start()
    time.sleep(5)

    a = Script2()
    a.start()
    time.sleep(5)

    while True:
        answer = raw_input('Type "x" to shutdown: ')
        if answer == 'x':
            print 'Shutting down....'
            time.sleep(1)
            print 'Done'
            sys.exit(0)

When x is typed, everything does shut down but the main script never
fully ends. Is there any way to get it to quit?

Thanks,

Harlin Seritt



More information about the Python-list mailing list