Commits

Matteo Bertini committed 1054d95

Comment and better logger error on failed rename

Comments (0)

Files changed (1)

         args, others = self.parser.parse_known_args(" ".join([self.comment]).split())
         if args.MKTARGETS is not None:
             args.INPLACE = args.CHECKEXISTS = args.MKTARGETS
+        # no option := None -> [], +OPTION := [] -> [all targets]
         self._inplace = set(self.targets if (args.INPLACE == []) else (args.INPLACE or []))
         self._duplicate = set(self.targets if (args.DUPLICATE == []) else (args.DUPLICATE or []))
         self._check_exists = set(self.targets if (args.CHECKEXISTS == []) else (args.CHECKEXISTS or []))
                 output = call_func(call_args)
 
                 for target in movable_targets:
-                    os.rename(tmp_files[target], target)
+                    try:
+                        os.rename(tmp_files[target], target)
+                    except:
+                        logger.error("Problem renaming temp file {0!r}".format(tmp_files[target]))
+                        raise
                 return output
             else:
                 logger.debug("{p}Skipping<{thread.name}>: {cmdline_color_skip}".format(**locals()))