mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-05 23:23:46 +02:00
Do not mask the correct exception when failing to create the backup metadata.opf file
This commit is contained in:
parent
18bd7879ed
commit
f0ca2c0cc3
1 changed files with 9 additions and 2 deletions
|
|
@ -8,7 +8,7 @@
|
|||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
# Imports {{{
|
||||
import os, shutil, uuid, json, glob, time, cPickle, hashlib, errno
|
||||
import os, shutil, uuid, json, glob, time, cPickle, hashlib, errno, sys
|
||||
from functools import partial
|
||||
|
||||
import apsw
|
||||
|
|
@ -1538,7 +1538,14 @@ def write_backup(self, path, raw):
|
|||
with lopen(path, 'wb') as f:
|
||||
f.write(raw)
|
||||
except EnvironmentError:
|
||||
os.makedirs(os.path.dirname(path))
|
||||
exc_info = sys.exc_info()
|
||||
try:
|
||||
os.makedirs(os.path.dirname(path))
|
||||
except EnvironmentError as err:
|
||||
if err.errno == errno.EEXIST:
|
||||
# Parent directory already exists, re-raise original exception
|
||||
raise exc_info[0], exc_info[1], exc_info[2]
|
||||
raise
|
||||
with lopen(path, 'wb') as f:
|
||||
f.write(raw)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue