cInt = len(sys.argv) - 2
pos = 2


while True:
    cStr = sys.argv[pos] + " "
    pos += 1
    cStr += sys.argv[pos]
    cList.append(cStr)
    pos += 1
    if pos > cInt:
        break

dd = GetDbData()
dd.dbConnect()
dd.getData(cList, sys.argv[1])
dd.dbClose()

cc = CourseContainer()
cc.addLectureList(dd.lList)
cc.addTutorialList(dd.tuList)
cc.addLaboratoryList(dd.laList)

sc = ScheduleContainer(cList, cc)
sc.generateSchedules()
# print "ball sack"
print sc.toJSON()


# end of script
                                    classList = []
                                    tempNumErrors = numErrors = 0
                    else: 
                        if(tempNumErrors==0):
                            classList = [specificClass0,specificClass1]
                            self.add(Schedule(classList))
                            classList = []
                            tempNumErrors = numErrors = 0
            else: 
                if(numErrors==0):
                    classList = [specificClass0]
                    self.add(Schedule(classList))
                    classList = []
                    tempNumErrors = numErrors = 0

courseMap = CourseContainer()
"""#---------------------------
courseMap.addClass("ENGR",371,2,3,"LEC","CC","John Smith",[1,2],"12:30|13:45","H-4","SGW",[])
courseMap.addClass("ENGR",371,2,3,"TUT","CA","John Smith",[0,3],"12:30|13:45","H-123","SGW",[])
courseMap.addClass("ENGR",371,2,3,"LAB","CA CI","John Smith",[2],"12:30|13:45","H-123","SGW",[])
courseMap.addClass("ENGR",371,2,3,"LAB","CC CA CD","John Smith",[2],"12:30|13:45","H-123","SGW",[])
#---------------------------
courseMap.addClass("ENGR",331,2,3,"LEC","E","John Smith2",[2],"12:30|13:45","H-123","SGW",[])
courseMap.addClass("ENGR",331,2,3,"LAB","E EC","John Smith2",[3],"12:30|13:45","H-123","SGW",[])
#courseMap.addClass("ENGR",331,2,3,"LAB","E EA EI","John Smith2",[3],"18:30|19:45","H-123","SGW",[])
#---------------------------

courseMap.addClass("ENGR",201,2,3,"LEC","AA","John Smith2",["M|T"],"18:30|21:00","H-123","SGW",[])
courseMap.addClass("ENGR",201,2,3,"TUT","AA AB","John Smith2",["W"],"8:30|10:00","H-123","SGW",[])