Ejemplo n.º 1
0
 def getNavigationPages(self):
     naviPages = []
     for url in self.naviURLs:
         try:
             naviPages.append(NavigationPage(url, self, [], '', '', '', False, False))
         except Exception, e:
             Tools.printAndLog("Category.getNavigationPages has an error is: " + str(e), isError = True)
Ejemplo n.º 2
0
 def dumpObjToFile(self, obj, filePath):
     try:
         savefile = open(filePath, "wb")
         pickle.dump(obj, savefile, True)
         savefile.close()
     except Exception, e:
         msg = u'An error occered when use dumpObjToFile function, and the error is ' + str(e) + '\n'
         Tools.printAndLog(msg, isError = True)
Ejemplo n.º 3
0
    def loadObjFromFile(self, filePath):
        try:
            readfile = open(filePath, "rb")
            ret = pickle.load(readfile)
            readfile.close()
            return ret
        except Exception, e:
            msg = 'An error occered when use loadObjFromFile function, and the error is ' + str(e) + '\n' + filePath
            Tools.printAndLog(msg, isError = True)
            return None



# if __name__ == "__main__":
#     webSite = WebSite("/home/lesshst/BFCrawel/nbweekly.ini")
#     crawel = Crawel(webSite)
#     crawel.start()
#     crawel.getCategoriesInfo()