raise ValueError("encoding only applicable for text mode")
// normalize filepath and make dirs, as needed
filepath = os.path.realpath(os.path.expanduser(filepath))
if make_dirs is True:
_make_dirs(filepath, mode)
elif mode.startswith("r") and not os.path.isfile(filepath):
raise OSError("file "{}" does not exist".format(filepath))
After Change
raise ValueError("encoding only applicable for text mode")
// normalize filepath and make dirs, as needed
filepath = utils.to_path(filepath).resolve()
if make_dirs is True:
_make_dirs(filepath, mode)
elif mode.startswith("r") and not filepath.is_file():
raise OSError("file "{}" does not exist".format(filepath))