I think I'm not using Try Except properly in this Python code Please offer some advice for this code.  It all works, but I know that its messy and I don't think the Exception catching is doing what I want it to.  Thanks in advance for any and all advice...

def main():
    # loop over this forever
    while True:
        print '--- Getting next job for Device: %s' % device['Name']
        # get a job from the db
        try:
            job = db.JobQ.find_one({'DeviceName':device['Name'],'Status':u'ToDo'})
        except Exception as e:
            print '!!! Error getting job for Device: %s' % device['Name']
        if job:
            # if there's a job, get all the other jobs for the same file
            try:
                job_list = [
                        j for j in db.JobQ.find(
                            {'Filename':job['Filename'],'Status':u'Todo'}
                            ).sort('Created',ASCENDING)
                        ]
            except Exception as e:
                print '!!! Error getting job list for Filename: %s' % job['Filename']

            for job in job_list:
                # mark the job 'InProgress'
                job = db.JobQ.find_and_modify(
                        {'_id':ObjectId(job['_id'])},
                        {'$set':{
                            'Status':u'InProgress','Started':datetime.now()
                            }},new=True
                        )
                print '--- Performing %s on %s' % (job['Type'], job['Filename'])
                # try to do the job.. each job raises its own exceptions
                try:
                    perform_job(job)
                    job['Status'] = u'Done'
                    job['Finished'] = datetime.now()
                    db.JobQ.save(job,safe=True)
                except Exception as e:
                    # if any job fails, ditch the rest of the jobs and move on
                    print '!!! Error performing job: %s' % e
                    print 'Subsequent jobs for this filename will not run: %s'\
                            % job['Filename']
                    for job in job_list:
                        job['Finished'] = datetime.now()
                        job['Status'] = u'Failed'
                        db.JobQ.save(job,safe=True)
        else:
            print '--- No more jobs for Device: %s' % device['Name']

        sleep(device['CycleTime'])


if __name__ == '__main__':
    main()
A couple things:


Instead of if job:, try if not job: ... continue .  This will allow the entire (large) content of that if-block to be outdented a level, making it a little more readable.
Instead of job_list = [ j for j in ... ]; use job_list = list( ... ).


Also, the logic in your failure code looks a bit suspect - you set subsequent jobs as 'failed' but nothing keeps them from being attempted again by the enclosing for loop.  I think you basically want a break at the end of the except block to exit the loop there, though that leaves the for loop still setting some potentially passed jobs as failed (consider the case when the first job passes but the second fails - the loop will set them all as failed).  So you might instead add a fail_the_rest = False flag just before the for job in joblist loop and then as the first line of the loop do if fail_the_rest: &lt;set failed&gt; continue and then change the except block to just set failure on that one job and then set fail_the_rest = True.  But that's all speculative due to a lack of understanding about how your job submission and pass/fails work.