1

I'm having a problem in running a command to get offlineimap running. I'm not an expert and don't code in python.

I need to run the following command:

python python/oauth2.py --generate_oauth2_token \
       --client_id=MY_CLIENT_ID --client_secret=MY_CLIENT_SECRET

And I'm using the following repository to access the oauth2.py: gmail-oauth2-tools.

The problem is that when running the command I'm getting the following syntax error in the .py file:

File "oauth2.py", line 297
print 'Missing options: %s' % ' '.join(missing)
                          ^
SyntaxError: invalid syntax

Below is the block of code where the error is contained:

    def RequireOptions(options, *args):
      missing = [arg for arg in args if getattr(options, arg) is None]
      if missing:
         print 'Missing options: %s' % ' '.join(missing)
         sys.exit(-1)

For more reference, what I'm trying to do is listed in this document: offlineimap.conf (line 946).

0

1 Answer 1

2

Had the same problem, running python2 python/oauth2.py instead of python python/oauth2.py fixed it for me (you need to have python2 installed on your system)

Sign up to request clarification or add additional context in comments.

3 Comments

It worked! Thanks a lot. I'm trying to get mutt to work with gmail but it has been a pain.
Yeah, it's annoying as hell, but it's worth it.
@Erik Sorry for getting late to the party :) I'm receiving same error, using Python 3.8.1. I typed: python oauth2.py ----client_id=##id --client_secret=##secret

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.