From 70f18067db6d81adc5df87153f6d2286aaabc5a9 Mon Sep 17 00:00:00 2001 From: Ritiek Malhotra Date: Fri, 16 Jun 2017 16:21:31 +0530 Subject: [PATCH] Capture requests.exception.ConnectionError --- spotdl.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spotdl.py b/spotdl.py index e52fc20..8bd76c9 100644 --- a/spotdl.py +++ b/spotdl.py @@ -261,15 +261,15 @@ def grab_list(file): global spotify spotify = spotipy.Spotify(auth=token) grab_single(raw_song, number=number) - except KeyboardInterrupt: - misc.grace_quit() - except (urllib2.URLError, IOError): + except (urllib2.URLError, requests.exceptions.ConnectionError, IOError): lines.append(raw_song) misc.trim_song(file) with open(file, 'a') as myfile: myfile.write(raw_song) print('Failed to download song. Will retry after other songs.') continue + except KeyboardInterrupt: + misc.grace_quit() finally: print('') misc.trim_song(file)