GoogleCloudPlatform / gcs-oauth2-boto-plugin

Auth plugin allowing use the use of OAuth 2.0 credentials for Google Cloud Storage in the Boto library.
Apache License 2.0
21 stars 38 forks source link

Import gcs-oauth2-boto-plugin results in KeyError #29

Open Nick-Harvey opened 7 years ago

Nick-Harvey commented 7 years ago

When following the steps on https://cloud.google.com/storage/docs/xml-api/gspythonlibrary I get the following error

import gcs_oauth2_boto_plugin
  File "/usr/local/lib/python3.6/site-packages/gcs_oauth2_boto_plugin/__init__.py", line 26, in <module>
    from gcs_oauth2_boto_plugin import oauth2_plugin
  File "/usr/local/lib/python3.6/site-packages/gcs_oauth2_boto_plugin/oauth2_plugin.py", line 22, in <module>
    from gcs_oauth2_boto_plugin import oauth2_client
  File "/usr/local/lib/python3.6/site-packages/gcs_oauth2_boto_plugin/oauth2_client.py", line 125
    except KeyError, e:
                   ^
SyntaxError: invalid syntax

Python script looks like:

import boto
import gcs_oauth2_boto_plugin
import os
import shutil
import StringIO
import tempfile
import time

# URI scheme for Cloud Storage.
GOOGLE_STORAGE = 'gs'
# URI scheme for accessing local files.
LOCAL_FILE = 'file'

# Fallback logic. In https://console.cloud.google.com/
# under Credentials, create a new client ID for an installed application.
# Required only if you have not configured client ID/secret in
# the .boto file or as environment variables.
CLIENT_ID = 'your client id'
CLIENT_SECRET = 'your client secret'
gcs_oauth2_boto_plugin.SetFallbackClientIdAndSecret(CLIENT_ID, CLIENT_SECRET)

Python version: 3.6.0

RotemShor commented 7 years ago

I have the same issue

vertcli commented 7 years ago

The same for me... trying to create a docker with gcs_oauth2_boto_plugin. When building no errors appear but when I import the library this error apears..

EmlynC commented 7 years ago

Confirmed here — that exception clause looks like Python 2. KeyError, e should read KeyError as e, there are other errors too past this though so it looks like it needs better porting from Python 2 to 3.

vertcli commented 7 years ago

True!

Lomascolo commented 6 years ago

Confirmed the issue, still not fixed.

gilblau commented 6 years ago

Did anyone get it working for python 2.7? I am trying to get it working with docker (passing the env var within the dockerfile) but it doesn't seem to work!