From c0c676c05d09be09807eceea5fbe5daab398232b Mon Sep 17 00:00:00 2001 From: NicoHood Date: Sat, 27 Aug 2016 13:16:45 +0200 Subject: [PATCH] Catch 'no space left' error #30 --- shuffle.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/shuffle.py b/shuffle.py index 29ea499..6fefb6b 100755 --- a/shuffle.py +++ b/shuffle.py @@ -628,7 +628,13 @@ class Shuffler(object): def write_database(self): with open(os.path.join(self.path, "iPod_Control", "iTunes", "iTunesSD"), "wb") as f: - f.write(self.tunessd.construct()) + try: + f.write(self.tunessd.construct()) + except IOError as e: + print "I/O error({0}): {1}".format(e.errno, e.strerror) + print "Error: Writing iPod database failed." + sys.exit(1) + print "Database written sucessful." # # Read all files from the directory