Can anyone help me with this code: opening file

I am new to programming, what am I doing wrong within this code? I keep getting an error

def main():
    while True:
        file_name = input("Enter the name of the course data file (or type 'quit'): ")
        if file_name.lower() == 'quit':
            break

        try:
            process_course_file("COP1000C")
        except FileNotFoundError:
            print(f"Error: File '{file_name}' not found.")
        except IOError as e:
            print(f"Error processing file: {e}")


def process_course_file(COP1000C):
    with open(COP1000C.txt, 'r') as file:
        course_info = file.readline().strip()
        instructor = file.readline().strip()
        term = file.readline().strip()

        students = []
        for name in file:
            grade = file.readline().strip()
            students.append({"name": name.strip(), "grade": grade})

    # Calculations
    total_students = len(students)
    passing_students = sum(int(student['grade']) >= 60 for student in students)
    failing_students = total_students - passing_students
    passing_percent = int(passing_students / total_students * 100)

    if total_students > 0:
        average_grade = sum(int(student['grade']) for student in students) / total_students
    else:
        average_grade = 0  # Handle division by zero

    # Generate Report
    print("\nCourse Grades Summary Report")
    print("-" * 30)
    print(f"Course: {course_info}")
    print(f"Instructor: {instructor}")
    print(f"Term: {term}")
    print("-" * 30)
    print("Student Name\tGrade")
    for student in students:
        print(f"{student['name']}\t\t{student['grade']}")
    print("-" * 30)
    print(f"Total Students: {total_students}")
    print(f"Passed: {passing_students}")
    print(f"Failed: {failing_students}")
    print(f"Passing Percentage: {passing_percent}%")
    print(f"Average Grade: {average_grade:.0f}")


if __name__ == "__main__":
    main()

It would be helpful if you could post the error you’re getting. However, I do see a problem on this line:

    with open(COP1000C.txt, 'r') as file:

The file name would have to be in quotes for it to work, like so:

    with open('COP1000C.txt', 'r') as file:

But, since it looks like you meant to pass the file name as an argument, you might rather want to write this:

def process_course_file(filename):
    with open(filename, 'r') as file:
        # and so on

The variable doesn’t need to be called filename—you can call it anything you want—but calling the variable the same name as the file itself seems to me like it would just be confusing.

Thank so much for your time and feedback, this is the error that I am getting

Traceback (most recent call last):
  File "/Users/trapnslayyllc/Desktop/gradesummary.PY/test.py", line 57, in <module>
    main()
  File "/Users/trapnslayyllc/Desktop/gradesummary.PY/test.py", line 8, in main
    process_course_file(COP1000C.txt)
NameError: name 'COP1000C' is not defined

hey! i figured it out now, thank you again i appreciate it