On Mon, Feb 15, 2010 at 10:53 AM, BJ Swope <span dir="ltr"><<a href="mailto:bigblueswope@gmail.com">bigblueswope@gmail.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

  File "/usr/lib/python2.5/email/_parseaddr.py", line 142, in mktime_tz<br>
    if data[9] is None:<br>
TypeError: 'NoneType' object is unsubscriptable<br>
<br>
I'm parsing a bunch of spam and using the date field from the spams<br>
for a date-time stamp.<br>
<br>
I've fixed the lib on my box to place the call inside a try/except<br>
clause to catch the exception now, but it seems the module has a bug<br>
in it.<br></blockquote><div><br></div><div>While there may or may not be a bug in the library, I don't think its where you're fixing. Just because an exception occurs in a function doesn't mean that function is broken: its documented as accepting a 10 item tuple, only. Functions in the stdlib generally -should- throw exceptions on invalid input.</div>

<div><br></div><div>Someone's passing None into it, which its not allowed to do. So -that's- where the bug probably is, I think. (Although it may not be the immediate of mktime_tz; it could be happening higher up on the stack)</div>

<div><br></div><div>Advice: Always post complete tracebacks to c.p.l/python-list :) </div><div><br></div></div><div name="mailplane_signature">--S</div>