diff --git a/pym/cl_profile.py b/pym/cl_profile.py index 29fc508..dd2f056 100644 --- a/pym/cl_profile.py +++ b/pym/cl_profile.py @@ -2020,20 +2020,22 @@ class profile(_file, _terms): flagForce = False # Если есть указатель на файл профиля (link) if objHeadNew.params.has_key("link"): - #prevOldFile = oldFile profileFile = objHeadNew.params['link'] - FO = self.openNewFile(profileFile) - buff = FO.read() - FO.close() + foundProfileFile = os.path.exists(profileFile) + if foundProfileFile: + FO = self.openNewFile(profileFile) + buff = FO.read() + FO.close() if os.path.exists(oldFile): os.remove(oldFile) - fd = os.open(oldFile, os.O_CREAT) - os.close(fd) - os.chmod(oldFile, self._mode) - os.chown(oldFile, self._uid, self._gid) - FON = open (oldFile, "r+") - FON.write(buff) - FON.close() + if foundProfileFile: + fd = os.open(oldFile, os.O_CREAT) + os.close(fd) + os.chmod(oldFile, self._mode) + os.chown(oldFile, self._uid, self._gid) + FON = open (oldFile, "r+") + FON.write(buff) + FON.close() # Если символическая ссылка if objHeadNew.params.has_key("symbolic"):