sys.stdout.write(" " * numOfWhiteSpace) print("[ OK ]") # sys.stdout.flush() def printFail(self): numOfWhiteSpace = self.consoleLength - self.usedLength - 8 sys.stdout.write("[-] %s" % self.processText) sys.stdout.write(" " * numOfWhiteSpace) print("[ FAIL ]") # sys.stdout.flush() if __name__ == "__main__": CSVFILE = "C:\\Users\\emrecan\\Documents\\PythonWin32Automation\\test.csv" cH = CsvHandler.CsvHandler() # PathFinder is the class that finds the .doc files in specified directories. pF = PathFinder() pp = PrettyPrint(50) pp.printProcess("Checking csv file") if not pF.checkIfFileExists(CSVFILE): pp.printFail() pp.printError("The csv file does not exist! Exitting!!!") sys.exit(10) pp.printOk() pp.printProcess("Reading csv file") cH.readCsvFile(CSVFILE) pp.printOk()
# Generates a set of test courses which are valid from ObstacleGenerator import * from CsvHandler import * numCourses = 1000 for i in range(numCourses): # The course generated with obstacles and has a solution course = ObstacleGenerator() course.generate() field = ObstacleField(72, 96, 24, 34, 24, 6, course.pointobjects) # Used to save the file csvObj = CsvHandler() csvObj.addFieldToTable(field) fileName = "Test" + str(i) print(fileName) csvObj.saveTableToFile(fileName)