Skip to content

Commit

Permalink
Merge pull request #52 from statisticsnorway/20240822LeoFeilmeldinger
Browse files Browse the repository at this point in the history
20240822 leo feilmeldinger
  • Loading branch information
joxssb authored Aug 22, 2024
2 parents c2a4709 + a38f7cb commit 42293ba
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
13 changes: 6 additions & 7 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions src/ssb_konjunk/saving.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,9 @@ def read_ssb_file(
seperator: the seperator to use it filetype is csv. Default: ';'.
encoding: Encoding for file, base is latin1.
Raises:
FileNotFoundError: If no files matching the file path and filetype are found.
Returns:
pd.DataFrame: file as a data frame.
"""
Expand All @@ -376,6 +379,12 @@ def read_ssb_file(
if not version_number:
# If version number not specified then list out versions.
files = _get_files(file_path, filetype, fs=fs)
# If list is empty, no matching files of any version were found.
if not files:
raise FileNotFoundError(
f"Fant ingen {filetype}-filer som matcher filstien '{file_path}'."
)
# Otherwise, use the newest version of file.
file_path = files[-1]

# Different functions used for reading depending on the filetype.
Expand Down

0 comments on commit 42293ba

Please sign in to comment.