def run(): ''' Runs the command line interface. ''' input_path = raw_input("Enter the FULL path to a directory containing " \ + "the transcripts, or to a single transcript file: ") while not os.path.exists(input_path): input_path = raw_input("Target location does not exist! " \ + "Please enter a valid path: ") main_database_name = raw_input("Enter the FULL path to the desired " \ + "location of the main database: ") id_database_name = raw_input("Enter the FULL path to the desired " \ + "location of the database which will " \ + "store student's real-world identifiers: ") if os.path.isdir(input_path): file_processor.process_directory(input_path, main_database_name, id_database_name) elif os.path.isfile(input_path): file_processor.process_file(input_path, main_database_name, id_database_name) else: abort_program("Unknown input file or directory") print "Finished processing"
''' print msg print "Aborting program" sys.exit(1) if __name__ == "__main__": # don't want a full GUI Tk().withdraw() input_is_dir = askyesno(message="Do you want to parse multiple transcripts?") if input_is_dir: dirname = get_input_directory("Select directory containing transcripts") if os.path.isdir(dirname): main_database_name = get_main_database_name() id_database_name = get_id_database_name() file_processor.process_directory(dirname, main_database_name, \ id_database_name) else: abort_program("Not a directory") else: filename = get_input_filename("Select transcript") if os.path.isfile(filename): main_database_name = get_main_database_name() id_database_name = get_id_database_name() file_processor.process_file(filename, main_database_name, \ id_database_name) else: abort_program("Not a file")