import logging logger = logging.getLogger(__name__) def load(path): try: with open(path) as fh: return fh.read() except Exception: return None if __name__ == "__main__": load("data.txt")