gtalk_export icon indicating copy to clipboard operation
gtalk_export copied to clipboard

Fails with Python 3 with & without converting via 2to3

Open crawfordcomeaux opened this issue 8 years ago • 2 comments

Before converting:
ImportError: No module named 'HTMLParser'

After converting:

Processing mbox file at ./chats.mbox
Traceback (most recent call last):
  File "gtalk_export_2to3.py", line 139, in <module>
    parse_mbox(args.mbox_location, args.name, args.email, args.timestamp_format)
  File "gtalk_export_2to3.py", line 45, in parse_mbox
    sorted_mails = sorted(mbox, key=extract_date_mbox)
TypeError: unorderable types: NoneType() < tuple()

crawfordcomeaux avatar Sep 11 '16 06:09 crawfordcomeaux

Hmm. Does it work if you try it with Python 2? I haven't attempted to run this with Python 3 yet. At first glance, it looks like one of the emails you're asking gtalk_export to parse has no "Date" header, which would result in None being returned from the "extract_date_mbox" function:

def extract_date_mbox(email):
        date = email.get('Date')
        return parsedate(date)

If that's the case, previous experience suggests that you may be generating the mbox file via a means other than the Thunderbird-export method outlined in the README.md.

coandco avatar Sep 12 '16 01:09 coandco

In Python2, I get a different error. I tried several methods using the ImportExportTools add-on. I think something in the toolchain or some of my messages is breaking stuff.

The Python2 error was in a multipart/alternative message. From what I've read, parts of that type MAY have empty headers. I inspected things a little longer & then decided to instead change the program. I just submitted #6 as a result.

If anyone wants to try to figure it out, here's a naively scrubbed mbox file to play with, but I'm tapping out on this issue now ;)

problematic.txt

crawfordcomeaux avatar Sep 12 '16 02:09 crawfordcomeaux