Skip to content

Error importing discovery from the client API #270

@ThreeSixes

Description

@ThreeSixes

Hello, I'm getting a name exception when running a simple script. I've tried running the script in two ways:

from apiclient import discovery
import json

from pprint import pprint
from httplib2 import Http

from oauth2client.service_account import ServiceAccountCredentials

scopes = ['https://www.googleapis.com/auth/fusiontables']

credentials = ServiceAccountCredentials.from_json_keyfile_name(
    'service-account.json', scopes)

ft = discovery.build('fusiontables', 'v2', credentials=credentials)
pprint(ft)

Which gives:

Traceback (most recent call last):
File "apiTest.py", line 1, in
from apiclient import discovery
File "build/bdist.linux-x86_64/egg/apiclient/init.py", line 18, in
File "build/bdist.linux-x86_64/egg/googleapiclient/channel.py", line 64, in
ImportError: cannot import name util

And:

from apiclient.discovery import build
import json

from pprint import pprint
from httplib2 import Http

from oauth2client.service_account import ServiceAccountCredentials

scopes = ['https://www.googleapis.com/auth/fusiontables']

credentials = ServiceAccountCredentials.from_json_keyfile_name(
    'service-account.json', scopes)

ft = discovery.build('fusiontables', 'v2', credentials=credentials)
pprint(ft)
#print response

Which yields the same exception:

python apiTest.py
Traceback (most recent call last):
File "apiTest.py", line 1, in
from apiclient.discovery import build
File "build/bdist.linux-x86_64/egg/apiclient/init.py", line 18, in
File "build/bdist.linux-x86_64/egg/googleapiclient/channel.py", line 64, in
ImportError: cannot import name util

I'm not sure if I'm missing a prereq or what, but I'm not able to find a way around this.

Metadata

Metadata

Assignees

Labels

🚨This issue needs some love.triage meI really want to be triaged.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions