google / import-mailbox-to-gmail

Import .mbox files into Google Workspace

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error encoding mail

SettlerSW opened this issue · comments

Hello,

(Sorry for my bad english)
For some e-mail, i've an UnicodeDecodeError, it seems the e-mail is already in UTF-8.

13:07:01 INFO process_mbox_files@import-mailbox-to-gmail.py Processing message 17 in label 'dlabbe-import'
13:07:01 ERROR process_mbox_files@import-mailbox-to-gmail.py Failed to import mbox message
Traceback (most recent call last):
  File "import-mailbox-to-gmail.py", line 213, in process_mbox_files
    message_data = io.BytesIO(message.as_string().encode('utf-8'))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 2147: ordinal not in range(128)

Which Python versione are you using?

Python 2.7.11

Oh and i missed to tell you (but I think it's not the same problem), at the first launch i've had this error :
ImportError: cannot import name SignedJwtAssertionCredentials

So, i've installed oauth2client package (pip install...), but the last version of this package (2.0) don't fix, so i've installed the old 1.5.2 :
pip install oauth2client==1.5.2

Hi Settler, did installing the older version of oauth2client fix that ImportError for you? I'm having the same problem but struggling to overwrite the newer oauth with the older one..

Thanks

Hi shirkethic,

No, i've write a poor hot fix with my poor knowledge in python to import these type of mail (<5% of all mail) with a bad encoding.

With regards to the encoding issue: I think I managed to fix it, I'll upload a new release shortly.

With regards to the cannot import name SignedJwtAssertionCredentials error - the new release will fix it.

Thanks for reporting!

Fixed in commit f049fa4.

@Settler6079SW and @shirkethic, can you try the new version? Please let me know whether it works now.

Thanks!

Hi Liron,

Should we upgrade again back to the latest v of

pip install oauth2client

which version is correct for this build?

Many thanks!

Paul

On 11 Mar 2016, at 21:17, Liron Newman notifications@github.com wrote:

@Settler6079SW https://github.com/Settler6079SW, can you try the new version https://github.com/google/import-mailbox-to-gmail/releases/tag/v1.2? Please let me know whether it works now.

Thanks!


Reply to this email directly or view it on GitHub #7 (comment).

@shirkethic the correct version is the latest version of oauth2client.

You'd need to use pip install -U oauth2client to upgrade it to the latest version.

Hello @eesheesh

Here is the message :

13:01:27 ERROR process_mbox_files@import-mailbox-to-gmail.py Failed to import mbox message Traceback (most recent call last): File "import-mailbox-to-gmail.py", line 214, in process_mbox_files message_data = io.BytesIO(message.as_string().encode('ascii')) UnicodeDecodeError: 'ascii' codec can't decode byte 0xef in position 1920: ordinal not in range(128)

If you want, i have exported the 'message' object with pickle library.

Ok, I think I have it fixed now: https://github.com/google/import-mailbox-to-gmail/releases/tag/v1.3

If it still fails, would it be possible for you to send me the message object, if it doesn't contain any private information?

Hello @eesheesh

I think it's ok, thanks for your support.

Thanks for confirming!