fix: exceptions.OSError might not have attribute EEXIST defined
Since this is used in an except calse, we first don't mask the real cause and raise the original error. Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
parent
36165e391f
commit
36375daee6
@ -292,7 +292,8 @@ class MaildirFolder(BaseFolder):
|
|||||||
that was created."""
|
that was created."""
|
||||||
|
|
||||||
tmpname = os.path.join('tmp', filename)
|
tmpname = os.path.join('tmp', filename)
|
||||||
# open file and write it out
|
# Open file and write it out.
|
||||||
|
# XXX: why do we need to loop 7 times?
|
||||||
tries = 7
|
tries = 7
|
||||||
while tries:
|
while tries:
|
||||||
tries = tries - 1
|
tries = tries - 1
|
||||||
@ -301,6 +302,8 @@ class MaildirFolder(BaseFolder):
|
|||||||
os.O_EXCL|os.O_CREAT|os.O_WRONLY, 0o666)
|
os.O_EXCL|os.O_CREAT|os.O_WRONLY, 0o666)
|
||||||
break
|
break
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
|
if not hasattr(e, 'EEXIST'):
|
||||||
|
raise
|
||||||
if e.errno == e.EEXIST:
|
if e.errno == e.EEXIST:
|
||||||
if tries:
|
if tries:
|
||||||
time.sleep(0.23)
|
time.sleep(0.23)
|
||||||
|
Loading…
Reference in New Issue
Block a user