New submission from Matt Johnston <m...@ucc.asn.au>:

When opening mailboxes the module checks for errno.EACCES. This doesn't help if 
the location is mounted read-only. Something like the following (against Python 
2.6) would fix it, there are a few other checks in mailbox.py for EACCES too.

--- mailbox.py.orig     2011-02-24 15:02:22.000000000 +0800
+++ mailbox.py  2011-02-24 15:02:05.000000000 +0800
@@ -512,7 +512,7 @@ class _singlefileMailbox(Mailbox):
                     f = open(self._path, 'wb+')
                 else:
                     raise NoSuchMailboxError(self._path)
-            elif e.errno == errno.EACCES:
+            elif e.errno == errno.EACCES or e.errno == errno.EROFS:
                 f = open(self._path, 'rb')
             else:
                 raise

----------
components: Library (Lib)
messages: 129252
nosy: matt
priority: normal
severity: normal
status: open
title: mailbox should test for errno.EROFS
type: behavior
versions: Python 3.3

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue11306>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to