Responsive Ad Area

Share This Post

test

TypeError: the first argument must be callable in python

i’m trying to run my first project in python and i get “TypeError: the first argument must be callable” , and “Traceback (most recent call last):”
i have another main in another module and it has the same problems.

import os
from PL import courses, classrooms, students


def print_table(list_of_tuples):
    for item in list_of_tuples:
        print(item)


def main():
    clr_list = classrooms.getAllClr()
    clr_size = clr_list.__len__()
    counter = 1

    while os.path.isfile('schedule.db') and 
courses.getAllCourses().__len__ != 0:
        courses_list = courses.getAllCourses()
        if counter == 1:
            i = 0
            while i < clr_size:
                tmpCourse = courses_list[i]  # filling up the 
classrooms
                classrooms.updateClassroom(tmpCourse.id, 
tmpCourse.course_length, clr_list[i].id)
                students.reduceAmount(tmpCourse.course_name, 
tmpCourse.number_of_students)
                counter = counter + 1
        if counter != 1:
            for classroom in classrooms:
                if classroom.current_course_time_left == 0:
                    courses.deleteCourse(classroom.current_course_id)
                    classrooms.deleteCourseFromTable(classroom.id)
                    allCourses = courses.getAllCourses()
                    if len(allCourses) > 0:
                        for course in allCourses:
                            if course.isAvailable and 
classroom.current_course_time_left != 0:
                                classrooms.updateClassroom(course.id, 
course.course_length, classroom.id)
                                courses.changeAvailability(course.id)
                    elif len(allCourses) == 0:
                        break

            classrooms.reduceTimeLeft()
        studentsList = students.getAllStudents()
        classroomsList = classrooms.getAllClr()
        coursesList = courses.getAllCourses()
        print_table(studentsList)
        print_table(classroomsList)
        print_table(coursesList)


if __name__ == '__main__':
    main()

hope you’
ll be able to understand what are my mistakes


TypeError: the first argument must be callable in python
TypeError: the first argument must be callable in python
test
{$excerpt:n}

Share This Post

Leave a Reply

Your email address will not be Publishedd. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Skip to toolbar