More email module troubles...<sigh>

Sheila King usenet at thinkspot.net
Sun Feb 10 01:43:35 EST 2002


OK, I don't think I'm losing my mind...I'm reading the docs 
for the email module over and over. I've looked at this raw 
email message and it doesn't appear to me to not be correctly 
formed.

I am able to successfully read the following email in from a 
file and instantiate it as an email.Message instance. I can 
walk() the parts. I can retrieve the types of the parts, 
etc...(OK, well the email module only detects a single part, 
which is true...), however, when I try this:

msg.as_string()

I get the following Traceback:

>>> msg.as_string()
Traceback (most recent call last):
  File "<pyshell#84>", line 1, in ?
    msg.as_string()
  File "E:\PYTHON\PYTHON22\lib\email\Message.py", line 59, in as_string
    g(self, unixfrom=unixfrom)
  File "E:\PYTHON\PYTHON22\lib\email\Generator.py", line 83, in __call__
    self._write(msg)
  File "E:\PYTHON\PYTHON22\lib\email\Generator.py", line 104, in _write
    self._dispatch(msg)
  File "E:\PYTHON\PYTHON22\lib\email\Generator.py", line 134, in _dispatch
    meth(msg)
  File "E:\PYTHON\PYTHON22\lib\email\Generator.py", line 240, in _handle_multipart
    for part in msg.get_payload():
  File "E:\PYTHON\PYTHON22\lib\email\Message.py", line 151, in __getitem__
    return self.get(name)
  File "E:\PYTHON\PYTHON22\lib\email\Message.py", line 214, in get
    name = name.lower()
AttributeError: 'int' object has no attribute 'lower'


Umm...I don't think I'm doing anything wrong?

Here is the raw message that I'm testing with, below this sig...

-- 
Sheila King
http://www.thinkspot.net/sheila/

"When introducing your puppy to an adult cat,
restrain the puppy, not the cat." -- Gwen Bailey,
_The Perfect Puppy: How to Raise a Well-behaved Dog_


>From DirecTV4Free!!!!@yahoo.com Fri Feb 08 04:45:43 2002
Return-Path: <DirecTV4Free!!!!@yahoo.com>
Delivered-To: xthinkspot-usenet at thinkspot.net
Received: (qmail 3201 invoked from network); 8 Feb 2002 09:45:03 -0000
Received: from unknown (HELO mx.futurequest.net) (130.91.184.200)
  by pt01.futurequest.net (63.151.147.170) with SMTP; 08 Feb 2002 09:45:03 -0000
From: "DirecTV 4 Free" <DirecTV4Free!!!!@yahoo.com>
Date: Fri, 08 Feb 2002 04:45:43
To: usenet at thinkspot.net
Subject: DirecTV 4 Free!!!!
MIME-Version: 1.0
Content-Type: multipart/related;
  boundary="----=_NextPart_MIMSCHNGDM"
Content-Transfer-Encoding: 7bit
Message-ID: PM20004:45:43 AM

This is an HTML email message.  If you see this, your mail client does not support HTML messages.

------=_NextPart_MIMSCHNGDM
Content-Type: text/html;charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

<title>Do you have a DirecTV system</title>
<style>
<!--
DIV.Section1 {
	page: Section1
}
SPAN.GramE {
	
}
H2 {
	FONT-WEIGHT: normal; FONT-SIZE: 12pt; FONT-FAMILY: "Times New Roman"; margin-left:0cm;
margin-right:0cm; margin-top:0cm; margin-bottom:0pt
}
-->
</style>
</head>

<body>

<p>     Do you have a DirecTV system? Are you tired of 
paying outrageous prices for what you have? Want more? Are you tired of sending 
your card out to other people and waiting days, possibly paying fees, every time 
DirecTV hits your card? Now you can re-set your own DIRECT TV Access Card 
yourself. You can get all the DIRECT TV channels for free. That's over 300 
channels, including all NFL, NHL, NBA, & Sports, HBO, Pay-per-View, Movies & 
Events, XXX and Local Channels. You can do this by using our simple access card 
activating device. It comes complete with the software you need, and simple 
detailed instructions as well as full support. All you need is a home computer.</p>
<p>Not want to mess around with your card? We provide a service where you can 
send your card to us and we load a PRIVATE Script on your card. The script we 
have does not suffer the shutdowns from DirecTV like others may. The last time 
our script was hit was in Oct. 2001, but if it does happen, we will fix it free 
of charge. Not want to send your card? No problem, we can provide you with a 
brand new card loaded with our software, you just put it in your receiver and 
enjoy the shows.</p>
<p>Not have DirecTV? Paying outrageous amounts for your cable that you only get 
a few channels on? Maybe not have cable available in your area or the "other" 
satellite company isn't providing what you expect? We also have all of the 
satellite equipment available in complete packages. DirecTV with TiVO, Ultimate 
TV, etc. are also available.</p>
<p>Live in an area where high speed broadband internet access is not available? 
We have cutting edge technology that can give you broadband internet access 
while watching your FREE DirecTV programming.</p>
<h2>           
                                                     
</h2>
<h2> </h2>
<h2>                                                                                           
Want More Information????</h2>
<p>                                                                                                           
Then </p>
<blockquote>
  <blockquote>
    <p class="MsoNormal"><span style="font-size: 12pt">

                                                             
                  </span><span
style="font-size: 18pt">
    <a style="color: blue; text-decoration: underline; text-underline: single"
href="mailto:freesat12000 at yahoo.com?subject=I Would Like More Information">
    CLICK HERE</a>.  </span></p>
  </blockquote>
</blockquote>
<p class="MsoNormal"><span style="font-size: 12pt"> </span></p>
<p class="MsoNormal"><span style="font-size: 12pt"> </span></p>
<p class="MsoNormal"><span style="font-size: 12pt"> </span></p>
<h2>  
<a href="mailto:freesatdelete at yahoo.com?subject=Remove From Your Mailing List Please">
Remove Me  From Your Mailing List Please</a></h2>

</body>

</html>
------=_NextPart_MIMSCHNGDM--







More information about the Python-list mailing list