def __init__(self, options=None): """ """ log.debug('%s Setup' % self.__class__.__name__) if not options: log.critical('No options passed to %s' % self.__class__.__name__) raise ValueError('No Options') self.options = options self.setup()
def __init__(self, filename=None, options=None): """ """ if not options: log.critical('No options passed to Parser') raise ValueError('No Options') self.options = options self.filename = filename log.debug('saved: %s and %s' % (self.filename, self.options)) self.files = [] log.debug('init file: %s' % self.files) self.handlers = get_handlers(self.options) log.debug('init finished') try: if not os.path.exists(self.filename): print "File path is invalid." elif not os.path.isfile(self.filename): print "File does not exist." elif not os.access(self.filename, os.R_OK): print "File cannot be read." else: self.pdf_file = PdfFileReader(self.filename, strict=False) except IOError as ex: print "I/O error({0}): {1}".format(ex.errno, ex.strerror) raise ex