Commits

Michał Górny committed 79d78ed

Fix backup creating error if no file to backup.

  • Participants
  • Parent commits 900e7e6

Comments (0)

Files changed (1)

File lib/flaggie/packagefile.py

 			f.close()
 
 			backup = self.path + '~'
-			shutil.copy2(self.path, backup)
+			try:
+				shutil.copy2(self.path, backup)
+			except IOError:
+				backup = None
 			shutil.move(tmpname, self.path)
-			shutil.copymode(backup, self.path)
+			if backup is not None:
+				shutil.copymode(backup, self.path)
 
 			for e in self:
 				e.modified = False