From ce01b4c5717416bfe92d49b6929b602590458f79 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 29 Jun 2019 11:09:52 +0530 Subject: [PATCH] Dont fail if the workaround for linux brokenness raise an exception --- src/calibre/__init__.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/calibre/__init__.py b/src/calibre/__init__.py index 28c90795fe..a522695435 100644 --- a/src/calibre/__init__.py +++ b/src/calibre/__init__.py @@ -673,6 +673,10 @@ def fsync(fileobj): # To check for the existence of the bug, simply run: # python -c "p = '/run/media/kovid/Kindle/driveinfo.calibre'; f = open(p, 'r+b'); os.fsync(f.fileno());" # this will cause the Kindle to disconnect. - with open(fileobj.name + '.linux-sucks', 'wb') as f: - f.write(b'I cannot believe I need to do this') - os.remove(f.name) + try: + with open(fileobj.name + '.linux-sucks', 'wb') as f: + f.write(b'I cannot believe I need to do this') + os.remove(f.name) + except Exception: + import traceback + traceback.print_exc()