plain_text_extractor.py 588 B

1234567891011121314151617
  1. import logging
  2. import shutil
  3. from toolchain.extractors.extraction_error import ExtractionError
  4. from toolchain.extractors.text_extractor import TextExtractor
  5. logger = logging.getLogger(__name__)
  6. class PlainTextExtractor(TextExtractor):
  7. def extract(self, input_path, output_path, config={}):
  8. logger.info("Copying plaintext from {0} to {1}.".format(input_path, output_path))
  9. try:
  10. shutil.copyfile(input_path, output_path)
  11. except Exception as e:
  12. logger.error("Error extracting file: {0}.".format(e))
  13. raise ExtractionError(e)