mailbox.Maildir(), confusing documentation

Peter Otten __peter__ at web.de
Sat Apr 5 05:55:10 EDT 2008


tinnews at isbd.co.uk wrote:

> Having got my Python 2.5.2 installed I'm trying some things out with
> the mailbox.Maildir() class.
> 
> If I do the following:-
> 
>     import maibox
>     mailbox.Maildir("/home/isbd/Mail/Li/pytest")
> 
> then the pytest Maildir mailbox is created - which is great but isn't
> documented.  If the above creates the maildir then what is the
> mailbox.Maildir.add_folder() method for?  I tried
> mailbox.Maildir.add_folder() and it appeared to do nothing, it didn't
> produce any errors either.

You didn't expect the dot, it seems:

>>> import mailbox
>>> m = mailbox.Maildir("alpha")
>>> m.add_folder("beta")
<mailbox.Maildir instance at 0x2af9e9e51f80>
>>>
$ find .
.
./alpha
./alpha/tmp
./alpha/cur
./alpha/new
./alpha/.beta
./alpha/.beta/tmp
./alpha/.beta/cur
./alpha/.beta/new
./alpha/.beta/maildirfolder
$

Peter



More information about the Python-list mailing list