def _open_file(path): if path == "-": return util.StdIOContextManager(sys.stdout) util.ensure_dir(os.path.dirname(path)) try: return open(path, "w") except (OSError, IOError) as e: cli.error("error opening %s: %s" % (path, e))
def _open_file(path): if path == "-": return util.StdIOContextManager(sys.stdout) return open(path, "w")