OSError: if ``filepath`` doesn"t exist but ``mode`` is read
// check args
if not isinstance(filepath, (str, bytes)):
raise TypeError("filepath must be a string, not {}".format(type(filepath)))
if encoding and "t" not in mode:
raise ValueError("encoding only applicable for text mode")
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))