troubleshooting Question

Exit(0) not being called

Avatar of batmansDad
batmansDadFlag for United States of America asked on
Python
4 Comments1 Solution307 ViewsLast Modified:
Hi All

I have the following python code:

    array1= []   
    for i in range(0,int(5),1):
        if (i < 6 ):
            log("Do Something with Entry")
    
    try:
        log("Do Something 1")
    except KeyboardInterrupt:
        log("ERROR')
    
    try:
        log("Do Something 2")
    except KeyboardInterrupt:
        log("ERROR')


except :
    print 'ERROR'
    
sys.exit(0)

The problem that I am having is that

log("Do Something 2") gets logged but the sys.exit(0) is never called, if I move this into the try it complains that it is not at the right level and gave an error message.

Is there something obvious that I am missing?
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 4 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros