coandco / gtalk_export

Export Google Talk/Hangouts chats to logfiles, using both mbox IMAP folders (for Google Talk) and Takeouts exports (for Google Hangouts)
MIT License
43 stars 8 forks source link

Error: argument must be 9-item sequence, not None (time stamp format?) #3

Closed bouchacha closed 8 years ago

bouchacha commented 8 years ago

First thank you for providing this wonderful tool for others to use. I'm very very green on this so apologies in advance if I've made any obvious rookie mistakes. I've downloaded python 2.7 then ran this command through a windows command prompt:

C:\Python27\python.exe C:\Gchat\gtalk_export.py -m C:\Gchat\Chat.mbox -j C:\Gchat\Hangouts.json -n "my name" -e myemail@gmail.com

The script starts up successfully but then I get this error message after a few seconds:

Processing mbox file at C:\Gchat\Chat.mbox
Traceback (most recent call last):
  File "C:\Gchat\gtalk_export.py", line 139, in <module>
    parse_mbox(args.mbox_location, args.name, args.email, args.timestamp_format)
  File "C:\Gchat\gtalk_export.py", line 59, in parse_mbox
    timestamp = time.strftime(timestamp_format, parsedate(rawtimestr))
TypeError: argument must be 9-item sequence, not None

I noticed that the script asks for a -t argument for time stamp format but I didn't include one. I didn't know how to specify one so I just tried a "-t YYYY-MM-DD" argument the second time but that didn't change the result. I'm not sure but is the script spitting back an error because it's missing an argument about time stamp format? Also, what's an example of a time stamp format I could specify?

Thanks in advance! :)

coandco commented 8 years ago

Hmm. So, first off, the problem isn't any timestamp format or lack of format you're passing the script. What it's complaining about is that the "parsedate" function called on line 59 is returning None for some reason. Looking at the documentation for the function, it looks like the reason may be that you have an email that's stored with a nonstandard date format, meaning that parsedate can't understand it. How did you generate your Chat.mbox file?

bouchacha commented 8 years ago

I'm 80% sure (this was a few months ago) I used Thunderbird to extract both the chat.mbox file and the hangout.json file. Is there a recommended generation method?

coandco commented 8 years ago

Thunderbird is the recommended method -- I have a quick tutorial in the README on the main project page. For now, I'd recommend re-exporting your mbox file using that method and trying again. If it still doesn't work (and you're okay with me temporarily having the mbox file), go ahead and send it to me and I'll take a crack at it to see what's going haywire.

bouchacha commented 8 years ago

I wasn't able to successfully re-export it because of the following:

  1. Somehow my original gmail account got some dates screwed up, likely due to some intense thunderbird reshuffling on my part.
  2. Import/Export tools seems to skip over messages from time to time. For example exporting a new mbox file dropped the number of message threads from 40k to 37k. Shrug.

What's the best way to send over the mbox file I had originally exported? It's fully readable and editable by thunderbird, so hopefully the worst case scenario is that I take out some of the offending messages in order to have the entire file parsable by your script. Thanks again for your help.

bouchacha commented 8 years ago

Let me know how I can send you the dropbox link. I wasn't able to find your contact information on this site.

coandco commented 8 years ago

After analyzing the provided mbox file, I found that it didn't have proper date formatting on the individual messages. It turned out that the original export was flawed somehow, and when @bouchacha re-exported, he was able to successfully run gtalk_export to completion once I fixed the regex for issue #1 .