Filename too long
talsafran opened this issue · 3 comments
Hi there,
I'm setting this up on a macOS Sierra system and have an issue when running the actual import command.
I get the following trace:
$ ./import-mailbox-to-gmail.py --json "/Users/tal/Downloads/Chrome/Josephine\ Email\ Import-1185bda2bfc5.json" --dir mbox
./import-mailbox-to-gmail.py: line 18: Import mbox files to a specified label for many users.
Liron Newman lironn@google.com
Copyright 2015 Google Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the License);
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an AS: File name too long
import: unable to grab mouse `': Resource temporarily unavailable @ error/xwindow.c/XSelectWindow/9202.
import: unable to grab mouse `': Resource temporarily unavailable @ error/xwindow.c/XSelectWindow/9202.
import: unable to grab mouse `': Resource temporarily unavailable @ error/xwindow.c/XSelectWindow/9202.
import: unable to grab mouse `': Resource temporarily unavailable @ error/xwindow.c/XSelectWindow/9202.
import: unable to grab mouse `': Resource temporarily unavailable @ error/xwindow.c/XSelectWindow/9202.
import: unable to grab mouse `': Resource temporarily unavailable @ error/xwindow.c/XSelectWindow/9202.
import: unable to grab mouse `': Resource temporarily unavailable @ error/xwindow.c/XSelectWindow/9202.
import: unable to grab mouse `': Resource temporarily unavailable @ error/xwindow.c/XSelectWindow/9202.
import: unable to grab mouse `': Resource temporarily unavailable @ error/xwindow.c/XSelectWindow/9202.
from: can't read /var/mail/apiclient
from: can't read /var/mail/apiclient.http
import: unable to grab mouse `': Resource temporarily unavailable @ error/xwindow.c/XSelectWindow/9202.
from: can't read /var/mail/apiclient.http
from: can't read /var/mail/oauth2client.service_account
import: unable to grab mouse `': Resource temporarily unavailable @ error/xwindow.c/XSelectWindow/9202.
import: unable to grab mouse `': Resource temporarily unavailable @ error/xwindow.c/XSelectWindow/9202.
./import-mailbox-to-gmail.py: line 38: APPLICATION_NAME: command not found
./import-mailbox-to-gmail.py: line 39: APPLICATION_VERSION: command not found
./import-mailbox-to-gmail.py: line 41: SCOPES: command not found
./import-mailbox-to-gmail.py: line 42: https://www.googleapis.com/auth/gmail.labels]: No such file or directory
./import-mailbox-to-gmail.py: line 45: syntax error near unexpected token `('
./import-mailbox-to-gmail.py: line 45: `parser = argparse.ArgumentParser('
Here is my tree structure, which I believe follows the instructions:
tal at Tals-MacBook-Air in ~/Projects/josephine-gmail-import
$ tree .
.
├── import-mailbox-to-gmail.py
└── mbox
└── email@example.com
└── All mail Including Spam and Trash.mbox
2 directories, 2 files
I have Python and Pip installed via Homebrew.
tal at Tals-MacBook-Air in ~/Projects/josephine-gmail-import
$ pip --version
pip 9.0.1 from /usr/local/lib/python2.7/site-packages (python 2.7)
tal at Tals-MacBook-Air in ~/Projects/josephine-gmail-import
$ python --version
Python 2.7.12
tal at Tals-MacBook-Air in ~/Projects/josephine-gmail-import
$ which python
/usr/local/bin/python
Any ideas? Happy to provide more system background etc. Thanks!
The output is strange - looks like it isn't Python that's interpreting the file. Can you try to run it like this?
python import-mailbox-to-gmail.py --json "/Users/tal/Downloads/Chrome/Josephine\ Email\ Import-1185bda2bfc5.json" --dir mbox
Your directory structure seems ok, so I don't think that would be an issue.
Thanks!
The shebang is missing in the python script.
If you want to run the script without typing "python" (as described in the documentation ./import-mailbox-to-gmail.py), you have to put
#!/usr/bin/env python
in the very first line of the script.
https://en.wikipedia.org/wiki/Shebang_(Unix)
This way the shell will know which interpreter it has to use.
Thanks @simonebracaloni! Good catch!