Skip to content

Commit

Permalink
[SPARK-49820][PYTHON] Change raise IOError to raise OSError
Browse files Browse the repository at this point in the history
### What changes were proposed in this pull request?
Change `raise IOError` to `raise OSError`

### Why are the changes needed?

> OSError is the builtin error type used for exceptions that relate to the operating system.
>
> In Python 3.3, a variety of other exceptions, like WindowsError were aliased to OSError. These aliases remain in place for compatibility with older versions of Python, but may be removed in future versions.
>
> Prefer using OSError directly, as it is more idiomatic and future-proof.
>

[RUFF rule](https://docs.astral.sh/ruff/rules/os-error-alias/)
[Python OSError](https://docs.python.org/3/library/exceptions.html#OSError)

### Does this PR introduce _any_ user-facing change?
No.

### How was this patch tested?
Pass GA

### Was this patch authored or co-authored using generative AI tooling?
No.

Closes apache#48287 from bjornjorgensen/IOError-to--OSError.

Authored-by: Bjørn Jørgensen <bjornjorgensen@gmail.com>
Signed-off-by: Hyukjin Kwon <gurwls223@apache.org>
  • Loading branch information
bjornjorgensen authored and HyukjinKwon committed Sep 27, 2024
1 parent d813f54 commit 0c19059
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion python/pyspark/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ def install_spark(dest, spark_version, hadoop_version, hive_version):
tar.close()
if os.path.exists(package_local_path):
os.remove(package_local_path)
raise IOError("Unable to download %s." % pretty_pkg_name)
raise OSError("Unable to download %s." % pretty_pkg_name)


def get_preferred_mirrors():
Expand Down

0 comments on commit 0c19059

Please sign in to comment.