From f64df8097417ad81be9efe78023f45d14117c422 Mon Sep 17 00:00:00 2001 From: multikatt Date: Wed, 3 Jun 2015 08:08:02 -0400 Subject: [PATCH] Catch failed folder creation --- beetsplug/ipfs.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/beetsplug/ipfs.py b/beetsplug/ipfs.py index 36398da06..795514e13 100644 --- a/beetsplug/ipfs.py +++ b/beetsplug/ipfs.py @@ -165,7 +165,12 @@ class IPFSPlugin(BeetsPlugin): lib_root = os.path.dirname(lib.path) remote_libs = lib_root + "/remotes" if not os.path.exists(remote_libs): - os.makedirs(remote_libs) + try: + os.makedirs(remote_libs) + except OSError as e: + msg = "Could not create {0}. Error: {1}".format(remote_libs, e) + self._log.error(msg) + return False path = remote_libs + "/" + lib_name + ".db" cmd = "ipfs get {0} -o".format(_hash).split() cmd.append(path)