def take_student_avatar(student_name): """ Prompts user for path to avatar file. :param student_name: str :return: str or None """ print(f'Load avatar image for {student_name}.') while True: avatar_file = input( r'Please paste complete filepath and name eg C:\my_folder\my_avatar.jpg or None to skip: ' ) if avatar_file.upper() == 'NONE': return None if avatar_file_exists(avatar_file): break # else: print('Supplied filepath cannot be found.') if avatar_file is None: return None cleaned_student_name = clean_for_filename(student_name) avatar_filename = f'{cleaned_student_name}.jpg' # process_student_avatar() # convert to jpg or whatever, copy image file to class_data avatar folder with filename that is student name return avatar_filename
def take_classlist_name_input(): while True: classlist_name = input('Please enter a name for the class: ') if input_is_essentially_blank(classlist_name): # blank input continue classlist_name = clean_for_filename(classlist_name) if classlist_exists(classlist_name): print('A class with this name already exists.') continue break return classlist_name
def take_classlist_name_input(): """ Prompts user for classlist name. It repeats until user provide correct classlist name. :return: str """ while True: classlist_name = input('Please enter a name for the class: ') if input_is_essentially_blank(classlist_name): # blank input continue classlist_name = clean_for_filename(classlist_name) if classlist_exists(classlist_name): print('A class with this name already exists.') continue break return classlist_name