Evaluates all notebooks in given directory and prints errors, if any

def check_notebooks_for_errors(notebooks_directory):
    ''' Evaluates all notebooks in given directory and prints errors, if any '''
    print("Checking notebooks in directory {} for errors".format(notebooks_directory))

    failed_notebooks_count = 0
    for file in os.listdir(notebooks_directory):
        if file.endswith(".ipynb"):
            print("Checking notebook " + file)
            full_file_path = os.path.join(notebooks_directory, file)
            output, errors = run_notebook(full_file_path)
            if errors is not None and len(errors) > 0:
                failed_notebooks_count += 1
                print("Errors in notebook " + file)
                print(errors)

    if failed_notebooks_count == 0:
        print("No errors found in notebooks under " + notebooks_directory)