Skip to content

Commit

Permalink
catch mkdir errors and skip items when mkdir fails, related to #10
Browse files Browse the repository at this point in the history
  • Loading branch information
meeb committed Oct 18, 2023
1 parent 66f44ef commit 667cbb7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion bandcampsync/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ def do_sync(cookies_path, cookies, dir_path, media_format, temp_dir_root):
else:
log.info(f'New media item, will download: "{item.band_name} / {item.item_title}" '
f'(id:{item.item_id}) in "{media_format}"')
local_path.mkdir(parents=True, exist_ok=True)
try:
local_path.mkdir(parents=True, exist_ok=True)
except OSError as e:
log.error('Failed to create directory: {local_path} ({e}), skipping purchase...')
continue
try:
initial_download_url = bandcamp.get_download_file_url(item, encoding=media_format)
except BandcampError as e:
Expand Down

0 comments on commit 667cbb7

Please sign in to comment.