mailbox.Maildir(), confusing documentation

Discussion in 'Python' started by tinnews@isbd.co.uk, Apr 3, 2008.

  1. Guest

    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.

    Anyway I'm happy that mailbox.Maildir() will create maildirs and it
    means I can do basically what I want but the documentation could be a
    bit more helpful. Are there any HowTos or FAQs for this (quite new I
    know) part of Python?

    --
    Chris Green
    , Apr 3, 2008
    #1
    1. Advertising

  2. Peter Otten Guest

    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
    Peter Otten, Apr 5, 2008
    #2
    1. Advertising

  3. Guest

    Peter Otten <> wrote:
    > 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:
    >

    I didn't 'expect' the dot because it's not standard maildir syntax,
    it's just one particular way of doing it.

    .... but thanks for pointing out what was going on. :)

    > >>> 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


    --
    Chris Green
    , Apr 6, 2008
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Matej Cepl

    mailbox.py examples (Maildir)

    Matej Cepl, Aug 6, 2003, in forum: Python
    Replies:
    1
    Views:
    462
    David M. Cooke
    Aug 6, 2003
  2. Replies:
    3
    Views:
    458
  3. Replies:
    0
    Views:
    345
  4. Replies:
    2
    Views:
    418
  5. Replies:
    0
    Views:
    397
Loading...

Share This Page