Skip to content

Commit

Permalink
Merge pull request #36 from eukarya-inc/feature/fix-35-handle-file-ex…
Browse files Browse the repository at this point in the history
…ists-case

fixes #35 don't raise FileExistsError if saved_path exists
  • Loading branch information
smellman authored Aug 23, 2023
2 parents ddee061 + f1add9a commit 83ee5fe
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions plateauutils/abc/plateau_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ def _download(self, url: str = "", target_dir: str = "") -> str:
filename = url.split("/")[-1]
# 保存先パスを作成
saved_path = join(target_dir, filename)
# 保存先パスが既に存在すればエラー
# 保存パスにファイルが存在すれば、そのパスを返す
if exists(saved_path):
raise FileExistsError(f"{saved_path} already exists.")
return saved_path
# 進捗を表示するため、ストリームでダウンロード
response = requests.get(url, stream=True)
# レスポンスが200ならダウンロード
Expand Down

0 comments on commit 83ee5fe

Please sign in to comment.