Skip to content

Commit

Permalink
refactor: raise OSError instead of FileNotFoundError
Browse files Browse the repository at this point in the history
  • Loading branch information
neutrinoceros committed Jun 29, 2020
1 parent 3934476 commit f39b82f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion yt/convenience.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def load(*args ,**kwargs):
from yt.data_objects.time_series import DatasetSeries
ts = DatasetSeries(*args, **kwargs)
return ts
except (TypeError, FileNotFoundError, YTOutputNotIdentified):
except (TypeError, OSError, YTOutputNotIdentified):
pass
# We check if either the first argument is a dict or list, in which
# case we try identifying candidates.
Expand Down
4 changes: 2 additions & 2 deletions yt/data_objects/time_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def get_filenames_from_glob_pattern(pattern):
# we try to match the pattern from the test data dir
file_list = glob.glob(epattern) or glob.glob(os.path.join(data_dir, pattern))
if not file_list:
raise FileNotFoundError("No file matched this pattern or pattern(s) {}".format(pattern))
raise OSError("No match found for pattern : {}".format(pattern))
return sorted(file_list)

attrs = ("refine_by", "dimensionality", "current_time",
Expand Down Expand Up @@ -490,7 +490,7 @@ def __init__(self, parameter_filename, find_outputs=False):
"""

if not os.path.exists(parameter_filename):
raise IOError(parameter_filename)
raise OSError(parameter_filename)
self.parameter_filename = parameter_filename
self.basename = os.path.basename(parameter_filename)
self.directory = os.path.dirname(parameter_filename)
Expand Down

0 comments on commit f39b82f

Please sign in to comment.