""" Utility functions for working with the filesystem, generally modeled after useful shell commands. """ import os def rm_f(path): """ Remove (unlink) a file, ignoring any exceptions that may be thrown. """ try: os.remove(path) except: pass def mkdir_p(path, mode): """ Create a directory hierarchy, ignoring any exceptions that may be thrown. """ try: os.makedirs(path, mode) except: pass