[Tutor] rfc822.Message

Reggie Dugard reggie@merfinllc.com
Mon Mar 17 11:12:04 2003


Vicki,

Sorry I wasn't clearer.  In my example, "2" is just the name of a file
in the current directory.  Maybe I misremember, but I thought I saw
another post from Kris that said he was running this code in the
directory that contained the mail file.

In any case, there is an mhlib module in python, which I've never had
occasion to use, but which seems to provide the functionality to find
and read MH mailboxes.  The doc string of the module should provide you
with enough information to get started.

Hope this clarifies things.


On Mon, 2003-03-17 at 07:52, vicki@stanfield.net wrote:
> Reggie Dugard wrote:
> 
> > > >>> import rfc822
> > > >>> mailmessage=rfc822.Message("2")
> > > Traceback (most recent call last):
> > >   File "<stdin>", line 1, in ?
> > >   File "/usr/lib/python2.2/rfc822.py", line 106, in
> > __init__
> > >     self.readheaders()
> > >   File "/usr/lib/python2.2/rfc822.py", line 153, in
> > readheaders
> > >     line = self.fp.readline()
> > > AttributeError: 'str' object has no attribute
> > 'readline'
> > > 
> > > 
> > > Btw Message "2" is a mail file inside a MH mail
> spool
> > directory.
> > Reggie
> 
> Hey Reggie,
> What tells the program that Message "2" is a mail file
> inside a MH mail spool directory? Is that a variable
> somewhere within the program?
> 
> --vicki
-- 
Reggie