GAM-team / got-your-back

Got Your Back (GYB) is a command line tool for backing up your Gmail messages to your computer using Gmail's API over HTTPS.
https://github.com/GAM-team/got-your-back/wiki
Apache License 2.0
2.56k stars 203 forks source link

Error when restoring from MBOX file #426

Open AnandJhaveri opened 1 year ago

AnandJhaveri commented 1 year ago

Full steps to reproduce the issue:

  1. Use Google Takeout to backup file from my old email id
  2. Use GYB to restore mbox file

Here's the command line:

C:\GYB> gyb --email anand.jhaveri100@gmail.com --action restore-mbox --local-folder "C:\Users\anand\Downloads\googledata\Takeout\Mail"

Using backup folder C:\Users\anand\Downloads\googledata\Takeout\Mail

Restoring from 18.74gb file C:\Users\anand\Downloads\googledata\Takeout\Mail\All mail Including Spam and Trash.mbox...

Expected outcome (what are you trying to do?): I am expecting to restore old emails downloaded via Google Takeout into my new email id

Actual outcome (what errors or bad behavior do you see instead?): Traceback (most recent call last):% File "gyb.py", line 2767, in File "gyb.py", line 2486, in main File "gyb.py", line 749, in callGAPI File "googleapiclient_helpers.py", line 130, in positional_wrapper File "googleapiclient\http.py", line 1604, in execute File "gyb.py", line 1696, in restored_message sqlite3.IntegrityError: datatype mismatch [12844] Failed to execute script 'gyb' due to unhandled exception!

Please help to resolve. Thanks.

Regards, Anand.

fabianocastello commented 1 year ago

+1 to the issue.

Using: C:\GYB>gyb --email xxxx@xxxx.usp.br --action restore-mbox --label-restored 202306 --memory-limit 1000000 --local-folder "c:\GYB\base"

Restoring from 26.26gb file c:\GYB\base\All mail Including Spam and Trash-011.mbox... Traceback (most recent call last):% File "gyb.py", line 2767, in File "gyb.py", line 2486, in main File "gyb.py", line 749, in callGAPI File "googleapiclient_helpers.py", line 130, in positional_wrapper File "googleapiclient\http.py", line 1604, in execute File "gyb.py", line 1696, in restored_message sqlite3.IntegrityError: datatype mismatch [17420] Failed to execute script 'gyb' due to unhandled exception!

IMPORTANT: I am restoring mbox file exported by google takeout from my personal account. Accoring to docs this is possible.

I know that python is running in backgroud. Could be something related to package versions?

Huang-CL commented 1 year ago

This procedure solved my problem

It looks like you are using a regular GYB backup folder to restore mbox files. Can you create an empty folder, place just the mbox files there and try again? ref: https://github.com/GAM-team/got-your-back/issues/269#issuecomment-626337031