(self, path, factory=None, create=True)
Initialize a single-file mailbox.
Initialize a single-file mailbox.
Initialize a single - file mailbox .
def __init__(self, path, factory=None, create=True):
        """Initialize a single-file mailbox."""
        Mailbox.__init__(self, path, factory, create)
        try:
            f = open(self._path, 'rb+')
        except OSError as e:
            if e.errno == errno.ENOENT:
                if create:
                    f = open(self._path, 'wb+')
                else:
                    raise NoSuchMailboxError(self._path)
            elif e.errno in (errno.EACCES, errno.EROFS):
                f = open(self._path, 'rb')
            else:
                raise
        self._file = f
        self._toc = None
        self._next_key = 0
        self._pending = False       # No changes require rewriting the file.
        self._pending_sync = False  # No need to sync the file
        self._locked = False
        self._file_length = None
def __init__ ( self , path , factory = None , create = True ) : Mailbox . __init__ ( self , path , factory , create ) try : f = open ( self . _path , 'rb+' ) except OSError as e : if e . errno == errno . ENOENT : if create : f = open ( self . _path , 'wb+' ) else : raise NoSuchMailboxError ( self . _path ) elif e . errno in ( errno . EACCES , errno . EROFS ) : f = open ( self . _path , 'rb' ) else : raise self . _file = f self . _toc = None self . _next_key = 0 self . _pending = False # No changes require rewriting the file. self . _pending_sync = False # No need to sync the file self . _locked = False self . _file_length = None