Traceback (most recent call last):

  File "C:/Users/91963/Downloads/112222.py", line 145, in generate_report

    cursor.execute(query, (start_date, end_date.strftime("%Y-%m-%d")))

NameError: name 'cursor' is not defined


During handling of the above exception, another exception occurred:


Traceback (most recent call last):

  File "C:/Users/91963/Downloads/112222.py", line 199, in <module>

    main()  # Run the main function when script is executed

  File "C:/Users/91963/Downloads/112222.py", line 193, in main

    generate_report()  # Generate attendance report

  File "C:/Users/91963/Downloads/112222.py", line 157, in generate_report

    cursor.close()

NameError: name 'cursor' is not defined