def main(args): families_csv_path, rows_csv_path = get_csv_paths(args) # Read csv files families = read_csv(families_csv_path, Family) families.sort(key=lambda f: f.size, reverse=True) hall = Hall(rows_csv_path) print('Found the following families:') print(*families, '\n', sep='\n') print(hall) # Seating loop families_are_sitting = False try_num = 0 while not families_are_sitting: try_num += 1 try: if sit_families(families, hall): families_are_sitting = True except HallFullException as e: print(e) hall.reset() if try_num % NUM_TRIES_BEFORE_WARN == 0 and args.use_gui: to_continue = easygui.boolbox( msg=f'I wasn\'t able to find a suitable seating ' f'arangement in {try_num} tries. This is either ' 'because I was unluck and I need to try a couple ' 'more times, or no possible seating arangements exist.' '\n\n Would you like to continue trying?') if not to_continue: quit() output_path = get_output_path(args) hall.to_csv(output_path)