Git Product home page Git Product logo

Comments (19)

eesheesh avatar eesheesh commented on April 27, 2024 1

Great, thanks for reporting the issue, testing and confirming!

from import-mailbox-to-gmail.

eesheesh avatar eesheesh commented on April 27, 2024

Try to run it prefixed by python, e.g.:
python import-mailbox-to-gmail.py --json ...

Also, make sure the current directory is the directory you put import-mailbox-to-gmail.py in.

Please let me know if that doesn't work.

from import-mailbox-to-gmail.

hellomozart avatar hellomozart commented on April 27, 2024

Thank you for your super speedy reply.

I made some progress. I actually didn't have the .py file in the current directory, so that was the problem. However, it's throwing up anothwe thing (probably another rookie error by me). Any thoughts?

Thanks again.

Hello-Mozart-MacBook-Pro:~ jasonbradbury$ python import-mailbox-to-gmail.py --json /Users/jasonbradbury/Desktop/MBOXTEST/jason@h*********t.co.uk/Gmail API-c1434271fb44.json --dir /Users/jasonbradbury/Desktop/MBOXTEST/jason@h*********t.co.uk/CVs.mbox
usage: import-mailbox-to-gmail.py [-h] [--auth_host_name AUTH_HOST_NAME]
                                  [--noauth_local_webserver]
                                  [--auth_host_port [AUTH_HOST_PORT [AUTH_HOST_PORT ...]]]
                                  [--logging_level {DEBUG,INFO,WARNING,ERROR,CRITICAL}]
                                  --json JSON --dir DIR [--no-fix-msgid]
                                  [--noreplaceqp] [--num_retries NUM_RETRIES]
                                  [--log LOG]
                                  [--httplib2debuglevel HTTPLIB2DEBUGLEVEL]
import-mailbox-to-gmail.py: error: unrecognized arguments: API-c1434271fb44.json

from import-mailbox-to-gmail.

PMox avatar PMox commented on April 27, 2024

from import-mailbox-to-gmail.

hellomozart avatar hellomozart commented on April 27, 2024

Thanks Paolo!

This has now come up:

Hello-Mozart-MacBook-Pro:~ jasonbradbury$ python import-mailbox-to-gmail.py --json
usage: import-mailbox-to-gmail.py [-h] [--auth_host_name AUTH_HOST_NAME]
                                  [--noauth_local_webserver]
                                  [--auth_host_port [AUTH_HOST_PORT [AUTH_HOST_PORT ...]]]
                                  [--logging_level {DEBUG,INFO,WARNING,ERROR,CRITICAL}]
                                  --json JSON --dir DIR [--no-fix-msgid]
                                  [--noreplaceqp] [--num_retries NUM_RETRIES]
                                  [--log LOG]
                                  [--httplib2debuglevel HTTPLIB2DEBUGLEVEL]
import-mailbox-to-gmail.py: error: argument --json: expected one argument
Hello-Mozart-MacBook-Pro:~ jasonbradbury$ *"*/Users/jasonbradbury/Desktop/MBOXTEST/jason@h*********t.co.uk/Gmail
> API-c1434271fb44.json*"* --dir
-bash: **/Users/jasonbradbury/Desktop/MBOXTEST/jason@h*********t.co.uk/Gmail
API-c1434271fb44.json**: No such file or directory
Hello-Mozart-MacBook-Pro:~ jasonbradbury$ /Users/jasonbradbury/Desktop/MBOXTEST/jason@h*********t.co.uk/CVs.mbox
-bash: /Users/jasonbradbury/Desktop/MBOXTEST/jason@h*********t.co.uk/CVs.mbox: is a directory
Hello-Mozart-MacBook-Pro:~ jasonbradbury$ 

Really appreciate the help!

from import-mailbox-to-gmail.

eesheesh avatar eesheesh commented on April 27, 2024

@PMox your response, while correct, was garbled by GitHub. :)

The correct commandline is:
python import-mailbox-to-gmail.py --json "/Users/jasonbradbury/Desktop/MBOXTEST/[email protected]/Gmail API-c1434271fb44.json" --dir /Users/jasonbradbury/Desktop/MBOXTEST/[email protected]/CVs.mbox

Note that the dir argument here is probably incorrect. You probably need it to be:
python import-mailbox-to-gmail.py --json "/Users/jasonbradbury/Desktop/MBOXTEST/[email protected]/Gmail API-c1434271fb44.json" --dir /Users/jasonbradbury/Desktop/MBOXTEST

This will import the file named CVs.mbox to [email protected]'s account under a "CVs" label.

from import-mailbox-to-gmail.

hellomozart avatar hellomozart commented on April 27, 2024

Thank you Liron & Paolo. Will give this a go. Stand by!

from import-mailbox-to-gmail.

hellomozart avatar hellomozart commented on April 27, 2024

Sorry, didn't mean to close the thread! Let me know if there looks like something is wrong from may log. Thank you!

from import-mailbox-to-gmail.

hellomozart avatar hellomozart commented on April 27, 2024

Here's the result from another try in Terminal:

Hello-Mozart-MacBook-Pro:~ jasonbradbury$ python import-mailbox-to-gmail.py --json "/Users/jasonbradbury/Desktop/MBOXTEST/jason@h*********t.co.uk/Gmail API-c1434271fb44.json" --dir /Users/jasonbradbury/Desktop/MBOXTEST/[email protected]
14:54:52 INFO [email protected] *** Starting import-mailbox-to-gmail 1.3 on Python 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 12:39:47) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] ***
14:54:52 INFO [email protected] Arguments:
14:54:52 INFO [email protected] 	auth_host_name: 'localhost'
14:54:52 INFO [email protected] 	auth_host_port: [8080, 8090]
14:54:52 INFO [email protected] 	dir: '/Users/jasonbradbury/Desktop/MBOXTEST/[email protected]'
14:54:52 INFO [email protected] 	fix_msgid: True
14:54:52 INFO [email protected] 	httplib2debuglevel: 0
14:54:52 INFO [email protected] 	json: '/Users/jasonbradbury/Desktop/MBOXTEST/[email protected]/Gmail API-c1434271fb44.json'
14:54:52 INFO [email protected] 	log: 'import-mailbox-to-gmail-36819.log'
14:54:52 INFO [email protected] 	logging_level: 'INFO'
14:54:52 INFO [email protected] 	noauth_local_webserver: False
14:54:52 INFO [email protected] 	num_retries: 10
14:54:52 INFO [email protected] 	replace_quoted_printable: True
14:54:52 INFO [email protected] Processing user CVs.mbox
14:54:52 WARNING autodetect@__init__.py file_cache is unavailable when using oauth2client >= 4.0.0
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/googleapiclient/discovery_cache/__init__.py", line 41, in autodetect
    from . import file_cache
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/googleapiclient/discovery_cache/file_cache.py", line 41, in <module>
    'file_cache is unavailable when using oauth2client >= 4.0.0')
ImportError: file_cache is unavailable when using oauth2client >= 4.0.0
14:54:52 INFO [email protected] URL being requested: GET https://www.googleapis.com/discovery/v1/apis/gmail/v1/rest
14:54:52 INFO [email protected] Attempting refresh to obtain initial access_token
14:54:52 INFO [email protected] Refreshing access_token
14:54:53 INFO [email protected] Failed to retrieve access token: {
  "error" : "invalid_request",
  "error_description" : "Invalid impersonation prn email address."
}
14:54:53 ERROR [email protected] Can't get access token for user CVs.mbox
14:54:53 ERROR [email protected] Can't process user CVs.mbox
Traceback (most recent call last):
  File "import-mailbox-to-gmail.py", line 307, in main
    service = discovery.build('gmail', 'v1', http=http)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/oauth2client/_helpers.py", line 133, in positional_wrapper
    return wrapped(*args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/googleapiclient/discovery.py", line 228, in build
    requested_url, discovery_http, cache_discovery, cache)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/googleapiclient/discovery.py", line 275, in _retrieve_discovery_doc
    resp, content = http.request(actual_url)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/oauth2client/transport.py", line 159, in new_request
    credentials._refresh(orig_request_method)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/oauth2client/client.py", line 749, in _refresh
    self._do_refresh_request(http)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/oauth2client/client.py", line 819, in _do_refresh_request
    raise HttpAccessTokenRefreshError(error_msg, status=resp.status)
HttpAccessTokenRefreshError: invalid_request: Invalid impersonation prn email address.
14:54:53 INFO [email protected] *** Done importing all users from directory '/Users/jasonbradbury/Desktop/MBOXTEST/[email protected]'
14:54:53 INFO [email protected] *** Import summary:
14:54:53 INFO [email protected]     0 users imported with no failures
14:54:53 INFO [email protected]     0 users imported with some failures
14:54:53 INFO [email protected]     1 users failed
14:54:53 INFO [email protected]     0 labels (mbox files) imported with no failures
14:54:53 INFO [email protected]     0 labels (mbox files) imported with some failures
14:54:53 INFO [email protected]     0 labels (mbox files) failed
14:54:53 INFO [email protected]     0 messages imported successfully
14:54:53 INFO [email protected]     0 messages failed

14:54:53 INFO [email protected] *** Check log file import-mailbox-to-gmail-36819.log for detailed errors.
14:54:53 INFO [email protected] Finished.

from import-mailbox-to-gmail.

eesheesh avatar eesheesh commented on April 27, 2024

The issue is that you set dir to "/Users/jasonbradbury/Desktop/MBOXTEST/[email protected]". This means that it would treat subdirectories of /Users/jasonbradbury/Desktop/MBOXTEST/[email protected] as the users.

You probably want to set dir to ""/Users/jasonbradbury/Desktop/MBOXTEST".

from import-mailbox-to-gmail.

hellomozart avatar hellomozart commented on April 27, 2024

Hmmmm. I thought I did that, anyway... I changed that and got the following error:

Hello-Mozart-MacBook-Pro:~ jasonbradbury$ python import-mailbox-to-gmail.py --json "/Users/jasonbradbury/Gmail\API-c1434271fb44.json" --dir ""/Users/jasonbradbury/Desktop/MBOXTEST""
16:47:34 INFO [email protected] *** Starting import-mailbox-to-gmail 1.3 on Python 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 12:39:47) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] ***
16:47:34 INFO [email protected] Arguments:
16:47:34 INFO [email protected] 	auth_host_name: 'localhost'
16:47:34 INFO [email protected] 	auth_host_port: [8080, 8090]
16:47:34 INFO [email protected] 	dir: '/Users/jasonbradbury/Desktop/MBOXTEST'
16:47:34 INFO [email protected] 	fix_msgid: True
16:47:34 INFO [email protected] 	httplib2debuglevel: 0
16:47:34 INFO [email protected] 	json: '/Users/jasonbradbury/Gmail\\API-c1434271fb44.json'
16:47:34 INFO [email protected] 	log: 'import-mailbox-to-gmail-59398.log'
16:47:34 INFO [email protected] 	logging_level: 'INFO'
16:47:34 INFO [email protected] 	noauth_local_webserver: False
16:47:34 INFO [email protected] 	num_retries: 10
16:47:34 INFO [email protected] 	replace_quoted_printable: True
16:47:34 INFO [email protected] Processing user [email protected]
16:47:34 ERROR [email protected] Can't get access token for user [email protected]
16:47:34 ERROR [email protected] Can't process user [email protected]
Traceback (most recent call last):
  File "import-mailbox-to-gmail.py", line 303, in main
    credentials = get_credentials(username)
  File "import-mailbox-to-gmail.py", line 122, in get_credentials
    scopes=SCOPES).create_delegated(username)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/oauth2client/service_account.py", line 219, in from_json_keyfile_name
    with open(filename, 'r') as file_obj:
IOError: [Errno 2] No such file or directory: '/Users/jasonbradbury/Gmail\\API-c1434271fb44.json'
16:47:34 INFO [email protected] *** Done importing all users from directory '/Users/jasonbradbury/Desktop/MBOXTEST'
16:47:34 INFO [email protected] *** Import summary:
16:47:34 INFO [email protected]     0 users imported with no failures
16:47:34 INFO [email protected]     0 users imported with some failures
16:47:34 INFO [email protected]     1 users failed
16:47:34 INFO [email protected]     0 labels (mbox files) imported with no failures
16:47:34 INFO [email protected]     0 labels (mbox files) imported with some failures
16:47:34 INFO [email protected]     0 labels (mbox files) failed
16:47:34 INFO [email protected]     0 messages imported successfully
16:47:34 INFO [email protected]     0 messages failed

16:47:34 INFO [email protected] *** Check log file import-mailbox-to-gmail-59398.log for detailed errors.
16:47:34 INFO [email protected] Finished.

In case it is useful, here is the log generated:

2017-08-25T16:47:34 (+0100) 59398 INFO main (import-mailbox-to-gmail.py:285) *** Starting import-mailbox-to-gmail 1.3 on Python 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 12:39:47) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] ***
2017-08-25T16:47:34 (+0100) 59398 INFO main (import-mailbox-to-gmail.py:286) Arguments:
2017-08-25T16:47:34 (+0100) 59398 INFO main (import-mailbox-to-gmail.py:288) 	auth_host_name: 'localhost'
2017-08-25T16:47:34 (+0100) 59398 INFO main (import-mailbox-to-gmail.py:288) 	auth_host_port: [8080, 8090]
2017-08-25T16:47:34 (+0100) 59398 INFO main (import-mailbox-to-gmail.py:288) 	dir: '/Users/jasonbradbury/Desktop/MBOXTEST'
2017-08-25T16:47:34 (+0100) 59398 INFO main (import-mailbox-to-gmail.py:288) 	fix_msgid: True
2017-08-25T16:47:34 (+0100) 59398 INFO main (import-mailbox-to-gmail.py:288) 	httplib2debuglevel: 0
2017-08-25T16:47:34 (+0100) 59398 INFO main (import-mailbox-to-gmail.py:288) 	json: '/Users/jasonbradbury/Gmail\\API-c1434271fb44.json'
2017-08-25T16:47:34 (+0100) 59398 INFO main (import-mailbox-to-gmail.py:288) 	log: 'import-mailbox-to-gmail-59398.log'
2017-08-25T16:47:34 (+0100) 59398 INFO main (import-mailbox-to-gmail.py:288) 	logging_level: 'INFO'
2017-08-25T16:47:34 (+0100) 59398 INFO main (import-mailbox-to-gmail.py:288) 	noauth_local_webserver: False
2017-08-25T16:47:34 (+0100) 59398 INFO main (import-mailbox-to-gmail.py:288) 	num_retries: 10
2017-08-25T16:47:34 (+0100) 59398 INFO main (import-mailbox-to-gmail.py:288) 	replace_quoted_printable: True
2017-08-25T16:47:34 (+0100) 59398 INFO main (import-mailbox-to-gmail.py:301) Processing user [email protected]
2017-08-25T16:47:34 (+0100) 59398 ERROR main (import-mailbox-to-gmail.py:309) Can't get access token for user [email protected]
2017-08-25T16:47:34 (+0100) 59398 ERROR main (import-mailbox-to-gmail.py:347) Can't process user [email protected]
Traceback (most recent call last):
  File "import-mailbox-to-gmail.py", line 303, in main
    credentials = get_credentials(username)
  File "import-mailbox-to-gmail.py", line 122, in get_credentials
    scopes=SCOPES).create_delegated(username)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/oauth2client/service_account.py", line 219, in from_json_keyfile_name
    with open(filename, 'r') as file_obj:
IOError: [Errno 2] No such file or directory: '/Users/jasonbradbury/Gmail\\API-c1434271fb44.json'
2017-08-25T16:47:34 (+0100) 59398 INFO main (import-mailbox-to-gmail.py:348) *** Done importing all users from directory '/Users/jasonbradbury/Desktop/MBOXTEST'
2017-08-25T16:47:34 (+0100) 59398 INFO main (import-mailbox-to-gmail.py:349) *** Import summary:
2017-08-25T16:47:34 (+0100) 59398 INFO main (import-mailbox-to-gmail.py:351)     0 users imported with no failures
2017-08-25T16:47:34 (+0100) 59398 INFO main (import-mailbox-to-gmail.py:353)     0 users imported with some failures
2017-08-25T16:47:34 (+0100) 59398 INFO main (import-mailbox-to-gmail.py:355)     1 users failed
2017-08-25T16:47:34 (+0100) 59398 INFO main (import-mailbox-to-gmail.py:357)     0 labels (mbox files) imported with no failures
2017-08-25T16:47:34 (+0100) 59398 INFO main (import-mailbox-to-gmail.py:359)     0 labels (mbox files) imported with some failures
2017-08-25T16:47:34 (+0100) 59398 INFO main (import-mailbox-to-gmail.py:361)     0 labels (mbox files) failed
2017-08-25T16:47:34 (+0100) 59398 INFO main (import-mailbox-to-gmail.py:363)     0 messages imported successfully
2017-08-25T16:47:34 (+0100) 59398 INFO main (import-mailbox-to-gmail.py:365)     0 messages failed

2017-08-25T16:47:34 (+0100) 59398 INFO main (import-mailbox-to-gmail.py:368) *** Check log file import-mailbox-to-gmail-59398.log for detailed errors.
2017-08-25T16:47:34 (+0100) 59398 INFO main (import-mailbox-to-gmail.py:369) Finished.


Thanks for your continued support!

from import-mailbox-to-gmail.

eesheesh avatar eesheesh commented on April 27, 2024

The issue is: No such file or directory: '/Users/jasonbradbury/Gmail\\API-c1434271fb44.json'

Try to use a slash instead of a backslash, i.e.:
python import-mailbox-to-gmail.py --json "/Users/jasonbradbury/Gmail/API-c1434271fb44.json" --dir "/Users/jasonbradbury/Desktop/MBOXTEST"

from import-mailbox-to-gmail.

hellomozart avatar hellomozart commented on April 27, 2024

That didn't work either, well it did. It solved the initial dir problem. I think there is a few more now:

Hello-Mozart-MacBook-Pro:~ jasonbradbury$ python import-mailbox-to-gmail.py --json "/Users/jasonbradbury/Gmail API-c1434271fb44.json" --dir "/Users/jasonbradbury/Desktop/MBOXTEST"
17:08:13 INFO [email protected] *** Starting import-mailbox-to-gmail 1.3 on Python 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 12:39:47) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] ***
17:08:13 INFO [email protected] Arguments:
17:08:13 INFO [email protected] 	auth_host_name: 'localhost'
17:08:13 INFO [email protected] 	auth_host_port: [8080, 8090]
17:08:13 INFO [email protected] 	dir: '/Users/jasonbradbury/Desktop/MBOXTEST'
17:08:13 INFO [email protected] 	fix_msgid: True
17:08:13 INFO [email protected] 	httplib2debuglevel: 0
17:08:13 INFO [email protected] 	json: '/Users/jasonbradbury/Gmail API-c1434271fb44.json'
17:08:13 INFO [email protected] 	log: 'import-mailbox-to-gmail-63290.log'
17:08:13 INFO [email protected] 	logging_level: 'INFO'
17:08:13 INFO [email protected] 	noauth_local_webserver: False
17:08:13 INFO [email protected] 	num_retries: 10
17:08:13 INFO [email protected] 	replace_quoted_printable: True
17:08:13 INFO [email protected] Processing user [email protected]
17:08:13 WARNING autodetect@__init__.py file_cache is unavailable when using oauth2client >= 4.0.0
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/googleapiclient/discovery_cache/__init__.py", line 41, in autodetect
    from . import file_cache
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/googleapiclient/discovery_cache/file_cache.py", line 41, in <module>
    'file_cache is unavailable when using oauth2client >= 4.0.0')
ImportError: file_cache is unavailable when using oauth2client >= 4.0.0
17:08:13 INFO [email protected] URL being requested: GET https://www.googleapis.com/discovery/v1/apis/gmail/v1/rest
17:08:13 INFO [email protected] Attempting refresh to obtain initial access_token
17:08:13 INFO [email protected] Refreshing access_token
17:08:14 INFO [email protected] URL being requested: GET https://www.googleapis.com/gmail/v1/users/jason%40hellomozart.co.uk/labels?fields=labels%28id%2Cname%29&alt=json
17:08:14 INFO [email protected] Skipping '/Users/jasonbradbury/Desktop/MBOXTEST/[email protected]/.DS_Store' because it doesn't have a .mbox extension
17:08:14 INFO [email protected] Starting processing of '/Users/jasonbradbury/Desktop/MBOXTEST/[email protected]/CVs.mbox'
17:08:14 ERROR [email protected] Can't process mbox files for user [email protected]
17:08:14 ERROR [email protected] Can't process user [email protected]
Traceback (most recent call last):
  File "import-mailbox-to-gmail.py", line 322, in main
    result = process_mbox_files(username, service, labels)
  File "import-mailbox-to-gmail.py", line 179, in process_mbox_files
    mbox = mailbox.mbox(full_filename)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/mailbox.py", line 832, in __init__
    _mboxMMDF.__init__(self, path, factory, create)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/mailbox.py", line 571, in __init__
    f = open(self._path, 'rb+')
IOError: [Errno 21] Is a directory: '/Users/jasonbradbury/Desktop/MBOXTEST/[email protected]/CVs.mbox'
17:08:14 INFO [email protected] *** Done importing all users from directory '/Users/jasonbradbury/Desktop/MBOXTEST'
17:08:14 INFO [email protected] *** Import summary:
17:08:14 INFO [email protected]     0 users imported with no failures
17:08:14 INFO [email protected]     0 users imported with some failures
17:08:14 INFO [email protected]     1 users failed
17:08:14 INFO [email protected]     0 labels (mbox files) imported with no failures
17:08:14 INFO [email protected]     0 labels (mbox files) imported with some failures
17:08:14 INFO [email protected]     0 labels (mbox files) failed
17:08:14 INFO [email protected]     0 messages imported successfully
17:08:14 INFO [email protected]     0 messages failed

17:08:14 INFO [email protected] *** Check log file import-mailbox-to-gmail-63290.log for detailed errors.
17:08:14 INFO [email protected] Finished.

17:08:14 ERROR [email protected] Can't process mbox files for user [email protected]

17:08:14 ERROR [email protected] Can't process user [email protected]

IOError: [Errno 21] Is a directory: '/Users/jasonbradbury/Desktop/MBOXTEST/[email protected]/CVs.mbox'

Could it be an issue with the API set up at Google?

Any thoughts? Sorry this is so drawn out!

from import-mailbox-to-gmail.

eesheesh avatar eesheesh commented on April 27, 2024

No problem! :)

It looks like "CVs.mbox" is a directory and not an mbox file.

Please attach the output of this command (note that uppercase/lowercase matters):
ls -laR /Users/jasonbradbury/Desktop/MBOXTEST

This should print the list of files and directories under /Users/jasonbradbury/Desktop/MBOXTEST and give us more insight about what needs to be changed, if any.

Please make sure you redact any private information shown there before posting.

Thanks!

from import-mailbox-to-gmail.

hellomozart avatar hellomozart commented on April 27, 2024

Thanks :)

Ok, here us the output:

Last login: Sat Aug 26 16:00:52 on ttys000
Hello-Mozart-MacBook-Pro:~ jasonbradbury$ ls -laR /Users/jasonbradbury/Desktop/MBOXTEST
total 16
drwxr-xr-x   4 jasonbradbury  staff   136 25 Aug 16:46 .
drwx------+ 25 jasonbradbury  staff   850 26 Aug 15:47 ..
-rw-r--r--@  1 jasonbradbury  staff  6148 25 Aug 16:47 .DS_Store
drwxr-xr-x   4 jasonbradbury  staff   136 25 Aug 16:45 [email protected]

/Users/jasonbradbury/Desktop/MBOXTEST/[email protected]:
total 16
drwxr-xr-x  4 jasonbradbury  staff   136 25 Aug 16:45 .
drwxr-xr-x  4 jasonbradbury  staff   136 25 Aug 16:46 ..
-rw-r--r--@ 1 jasonbradbury  staff  6148 25 Aug 16:45 .DS_Store
drwxr-xr-x@ 6 jasonbradbury  staff   204 25 Aug 12:10 CVs.mbox

/Users/jasonbradbury/Desktop/MBOXTEST/[email protected]/CVs.mbox:
total 26024
drwxr-xr-x@ 6 jasonbradbury  staff       204 25 Aug 12:10 .
drwxr-xr-x  4 jasonbradbury  staff       136 25 Aug 16:45 ..
-rw-------@ 1 jasonbradbury  staff       123 25 Aug 12:10 .lock
-rw-r--r--@ 1 jasonbradbury  staff       330 25 Aug 12:10 Info.plist
-rw-------@ 1 jasonbradbury  staff  13308411 25 Aug 12:10 mbox
-rw-r--r--@ 1 jasonbradbury  staff      3399 25 Aug 12:10 table_of_contents

I have tried using the mbox inside CVs.mbox (which is actually the 'large' multiple GB file) but it's not recognised as a .mbox. If that makes sense.

ps - I don't think there is any private information in this? On that note... nothing I have previously posted can compromise my accounts or computer right?

Thanks!

Jason

from import-mailbox-to-gmail.

eesheesh avatar eesheesh commented on April 27, 2024

Thanks for the details! I made a small update to try and add support for this scenario. Can you please download https://raw.githubusercontent.com/google/import-mailbox-to-gmail/master/import-mailbox-to-gmail.py and see if that works? You should still run it with:
python import-mailbox-to-gmail.py --json "/Users/jasonbradbury/Gmail API-c1434271fb44.json" --dir "/Users/jasonbradbury/Desktop/MBOXTEST"

Regarding private information - I don't see anything sensitive here (aside from your email address if you consider that sensitive). Feel free to edit your previous comments to remove it if you like.

from import-mailbox-to-gmail.

hellomozart avatar hellomozart commented on April 27, 2024

Hey! Ok great on the private information front, I may go back and edit out my e-mail just for spams sake, but anyway...

That fix seems to have done something! It created labels within Gmail: "CVs" and "CVs.mbox" However... It didn't upload any messages.

I tested importing the box back into Mail and it works fine, so the file is not corrupt or anything.

I feel like we're getting closer though?

Details below,
Thanks!

Jason

Hello-Mozart-MacBook-Pro:~ jasonbradbury$ python import-mailbox-to-gmail.py --json "/Users/jasonbradbury/Gmail API-c1434271fb44.json" --dir "/Users/jasonbradbury/Desktop/MBOXTEST"
12:05:03 INFO [email protected] *** Starting import-mailbox-to-gmail 1.3 on Python 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 12:39:47) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] ***
12:05:03 INFO [email protected] Arguments:
12:05:03 INFO [email protected] 	auth_host_name: 'localhost'
12:05:03 INFO [email protected] 	auth_host_port: [8080, 8090]
12:05:03 INFO [email protected] 	dir: '/Users/jasonbradbury/Desktop/MBOXTEST'
12:05:03 INFO [email protected] 	fix_msgid: True
12:05:03 INFO [email protected] 	from_message: 0
12:05:03 INFO [email protected] 	httplib2debuglevel: 0
12:05:03 INFO [email protected] 	json: '/Users/jasonbradbury/Gmail API-c1434271fb44.json'
12:05:03 INFO [email protected] 	log: 'import-mailbox-to-gmail-1414.log'
12:05:03 INFO [email protected] 	logging_level: 'INFO'
12:05:03 INFO [email protected] 	noauth_local_webserver: False
12:05:03 INFO [email protected] 	num_retries: 10
12:05:03 INFO [email protected] 	replace_quoted_printable: True
12:05:03 INFO [email protected] Processing user [email protected]
12:05:03 WARNING autodetect@__init__.py file_cache is unavailable when using oauth2client >= 4.0.0
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/googleapiclient/discovery_cache/__init__.py", line 41, in autodetect
    from . import file_cache
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/googleapiclient/discovery_cache/file_cache.py", line 41, in <module>
    'file_cache is unavailable when using oauth2client >= 4.0.0')
ImportError: file_cache is unavailable when using oauth2client >= 4.0.0
12:05:03 INFO [email protected] URL being requested: GET https://www.googleapis.com/discovery/v1/apis/gmail/v1/rest
12:05:03 INFO [email protected] Attempting refresh to obtain initial access_token
12:05:03 INFO [email protected] Refreshing access_token
12:05:05 INFO [email protected] URL being requested: GET https://www.googleapis.com/gmail/v1/users/jason%40hellomozart.co.uk/labels?fields=labels%28id%2Cname%29&alt=json
12:05:05 INFO [email protected] Label 'CVs.mbox' doesn't exist, creating it
12:05:05 INFO [email protected] URL being requested: POST https://www.googleapis.com/gmail/v1/users/jason%40hellomozart.co.uk/labels?alt=json
12:05:05 INFO [email protected] Label 'CVs.mbox' created
12:05:05 INFO [email protected] Skipping '/Users/jasonbradbury/Desktop/MBOXTEST/[email protected]/.DS_Store' because it doesn't have a .mbox extension
12:05:05 INFO [email protected] Skipping '/Users/jasonbradbury/Desktop/MBOXTEST/[email protected]/CVs.mbox/.lock' because it doesn't have a .mbox extension
12:05:05 INFO [email protected] Skipping '/Users/jasonbradbury/Desktop/MBOXTEST/[email protected]/CVs.mbox/Info.plist' because it doesn't have a .mbox extension
12:05:05 INFO [email protected] Skipping '/Users/jasonbradbury/Desktop/MBOXTEST/[email protected]/CVs.mbox/mbox' because it doesn't have a .mbox extension
12:05:05 INFO [email protected] Skipping '/Users/jasonbradbury/Desktop/MBOXTEST/[email protected]/CVs.mbox/table_of_contents' because it doesn't have a .mbox extension
12:05:05 INFO [email protected] Done importing user [email protected]. Labels: 0 succeeded, 0 with some errors, 0 failed. Messages: 0 succeeded, 0 failed.
12:05:05 INFO [email protected] *** Done importing all users from directory '/Users/jasonbradbury/Desktop/MBOXTEST'
12:05:05 INFO [email protected] *** Import summary:
12:05:05 INFO [email protected]     1 users imported with no failures
12:05:05 INFO [email protected]     0 users imported with some failures
12:05:05 INFO [email protected]     0 users failed
12:05:05 INFO [email protected]     0 labels (mbox files) imported with no failures
12:05:05 INFO [email protected]     0 labels (mbox files) imported with some failures
12:05:05 INFO [email protected]     0 labels (mbox files) failed
12:05:05 INFO [email protected]     0 messages imported successfully
12:05:05 INFO [email protected]     0 messages failed

12:05:05 INFO [email protected] Finished.

from import-mailbox-to-gmail.

eesheesh avatar eesheesh commented on April 27, 2024

I think I found the issue. Please try the new version of https://raw.githubusercontent.com/google/import-mailbox-to-gmail/master/import-mailbox-to-gmail.py with the same commandline.

Let me know if it works. :)

from import-mailbox-to-gmail.

hellomozart avatar hellomozart commented on April 27, 2024

Ah! It worked a treat. Thank you!! Now, just to uploading my 25,000 15GB of e-mails.
Thanks again!

from import-mailbox-to-gmail.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.