[Bf-extensions-cvs] [96ebb5a] master: io_blend_utils: be more lenient in cleaning up the temp_dir
Sybren A. Stüvel
noreply at git.blender.org
Tue Jan 17 17:29:42 CET 2017
Commit: 96ebb5adc27c5a52826fdcb09c3cc3d3af838c9b
Author: Sybren A. Stüvel
Date: Tue Jan 17 16:33:37 2017 +0100
Branches: master
https://developer.blender.org/rBA96ebb5adc27c5a52826fdcb09c3cc3d3af838c9b
io_blend_utils: be more lenient in cleaning up the temp_dir
self.temp_dir.cleanup() can raise a FileNotFoundError when BAM-pack
actually (correctly) cleaned up after itself.
===================================================================
M io_blend_utils/__init__.py
===================================================================
diff --git a/io_blend_utils/__init__.py b/io_blend_utils/__init__.py
index d6f3c26..61ad715 100644
--- a/io_blend_utils/__init__.py
+++ b/io_blend_utils/__init__.py
@@ -79,12 +79,18 @@ class ExportBlendPack(Operator, ExportHelper, SubprocessHelper):
self.log.info('Executing %s', cmd_to_log)
def process_post(self, returncode):
- if self.temp_dir is not None:
- try:
- self.temp_dir.cleanup()
- except:
- import traceback
- traceback.print_exc()
+ if self.temp_dir is None:
+ return
+
+ try:
+ self.log.debug('Cleaning up temp dir %s', self.temp_dir)
+ self.temp_dir.cleanup()
+ except FileNotFoundError:
+ # This is expected, the directory was already removed by BAM.
+ pass
+ except Exception:
+ self.log.exception('Unable to clean up temp dir %s', self.temp_dir)
+
self.log.info('Written to %s', self.outfname)
More information about the Bf-extensions-cvs
mailing list