Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails with Python 3 with & without converting via 2to3 #5

Open
crawfordcomeaux opened this issue Sep 11, 2016 · 2 comments
Open

Fails with Python 3 with & without converting via 2to3 #5

crawfordcomeaux opened this issue Sep 11, 2016 · 2 comments

Comments

@crawfordcomeaux
Copy link
Contributor

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()
@coandco
Copy link
Owner

coandco commented Sep 12, 2016

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.

@crawfordcomeaux
Copy link
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants