From d834bc6440e6295e33aa90ba09fc96938d3299ee Mon Sep 17 00:00:00 2001 From: rembo10 Date: Tue, 22 May 2012 17:14:56 +0530 Subject: [PATCH] Added try/except block to the folder chmod'ing - thanks to caulfie1d for the heads up --- headphones/postprocessor.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/headphones/postprocessor.py b/headphones/postprocessor.py index b1ea3d90..9084fae3 100644 --- a/headphones/postprocessor.py +++ b/headphones/postprocessor.py @@ -409,13 +409,18 @@ def moveFiles(albumpath, release, tracks): logger.warn('Error moving file %s: %s' % (files, e)) # Chmod the directories using the folder_format (script courtesy of premiso!) - folder_list = folder.split('/') - + folder_list = folder.split('/') temp_f = headphones.DESTINATION_DIR + for f in folder_list: + temp_f = os.path.join(temp_f, f) - os.chmod(os.path.normpath(temp_f).encode(headphones.SYS_ENCODING), int(headphones.FOLDER_PERMISSIONS, 8)) - + + try: + os.chmod(os.path.normpath(temp_f).encode(headphones.SYS_ENCODING), int(headphones.FOLDER_PERMISSIONS, 8)) + except Exception, e: + logger.error("Error trying to change permissions on folder: %s" % temp_f) + # If we failed to move all the files out of the directory, this will fail too try: shutil.rmtree(albumpath)