Line 95 contains an os.chmod command. If this command fails, e.g. for no such file or directory, the failure will be hidden by another failure - the exception handler tries to reference start_list, which is not initialized until line 96, resulting in UnboundLocalError: local variable 'start_list' referenced before assignment.
This can be worked around by adding start_list = [] between the try: on line 94 and the os.chmod on line 95.