On this page
  1. mailbox.NoSuchMailboxError
  2. Import
  3. Signature & Overview
  4. Methods & Attributes
  5. Usage
  6. Gotchas
  7. REPL Inspect

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

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

REPL Inspect

from mailbox import NoSuchMailboxError
help(NoSuchMailboxError)

Linked from

Related notes