From e13889baedf0f9f64c06cdc99d644a1eef462665 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 9 Feb 2022 09:06:38 +0530 Subject: [PATCH] Edit book: When saving a copy dont fail if the original file has no write permissions. --- src/calibre/gui2/tweak_book/save.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/calibre/gui2/tweak_book/save.py b/src/calibre/gui2/tweak_book/save.py index cc1351f8a8..08f9567373 100644 --- a/src/calibre/gui2/tweak_book/save.py +++ b/src/calibre/gui2/tweak_book/save.py @@ -4,7 +4,7 @@ __license__ = 'GPL v3' __copyright__ = '2013, Kovid Goyal ' -import shutil, os, errno +import shutil, os, errno, stat from threading import Thread from qt.core import (QObject, pyqtSignal, QLabel, QWidget, QHBoxLayout, Qt, QSize) @@ -49,7 +49,7 @@ def save_container(container, path): # Somebody deleted the original file if st is not None: try: - os.fchmod(fno, st.st_mode) + os.fchmod(fno, st.st_mode | stat.S_IWUSR) except OSError as err: if err.errno != errno.EPERM: raise