python won't create thread?
Question: I might be missing something silly, but ive ran my code in pythonwin and it
works, but when I run it in command-line it freaks

    
    
    import time, thread
    def print_t(name, delay):
        while 1:
            time.sleep(delay)
            print name
    try:
        thread.start_new_thread(print_t,("First Message",1,))
        thread.start_new_thread(print_t,("Second Message",2,))
    except Exception as e:
        print e
    
    Unhandled exception in thread started by
    sys.excepthook is missing
    lost sys.stderr
    
    Unhandled exception in thread started by
    sys.excepthook is missing
    lost sys.stderr
    


Answer: The exception happens when the main thread (the one that starts other threads)
finishes. In your code the main thread quits before any of your sub threads
(created by `start_new_thread`) finish. The solution is to wait at your main
thread till the child threads ends.

See the discussion [Simple threading in Python 2.6 using
thread.start_new_thread()](http://stackoverflow.com/questions/849674/simple-
threading-in-python-2-6-using-thread-start-new-thread)

