On this page
mailbox.NoSuchMailboxError
Prev: mailbox.MMDFMessage | Up: mailbox | Next: mailbox.NotEmptyError
Rel: mailbox.Babyl, mailbox.BabylMessage, mailbox.Error, mailbox.ExternalClashError
Ref: docs.python.org โ mailbox.NoSuchMailboxError
Tags: #public #python3 #stdlib #mailbox
Import
import mailbox
from mailbox import NoSuchMailboxError
Signature & Overview
mailbox.NoSuchMailboxError(...)
The specified mailbox does not exist and won't be created.
Methods & Attributes
NoSuchMailboxError.add_note(self, note, /)โ Add a note to the exceptionNoSuchMailboxError.with_traceback(self, tb, /)โ Set self.traceback to tb and return self.
Usage
import mailbox
from pathlib import Path
import tempfile
with tempfile.TemporaryDirectory() as tmp:
try:
mailbox.mbox(Path(tmp) / "missing.mbox", create=False)
except mailbox.NoSuchMailboxError:
assert True
Gotchas
- Raised when
create=Falseand the mailbox does not exist.
REPL Inspect
from mailbox import NoSuchMailboxError
help(NoSuchMailboxError)
Linked from
Related notes
- tuts/python3/stdlib_module/mailbox/MMDFMessage Linked here; links to this page; shared tags: #mailbox, #stdlib
- tuts/python3/stdlib_module/mailbox/NotEmptyError Linked here; links to this page; shared tags: #mailbox, #stdlib
- tuts/python3/stdlib_module/mailbox/Babyl Linked here; shared tags: #mailbox, #stdlib
- tuts/python3/stdlib_module/mailbox/BabylMessage Linked here; shared tags: #mailbox, #stdlib
- tuts/python3/stdlib_module/mailbox/Error Linked here; shared tags: #mailbox, #stdlib
- tuts/python3/stdlib_module/mailbox/ExternalClashError Linked here; shared tags: #mailbox, #stdlib
- tuts/python3/stdlib_module/mailbox/Mailbox Linked here; shared tags: #mailbox, #stdlib
- tuts/python3/stdlib_module/mailbox links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/mailbox/FormatError shared tags: #mailbox, #stdlib
- tuts/python3/stdlib_module/mailbox/Maildir shared tags: #mailbox, #stdlib