Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google OAuth API - Python client import error

I am trying to get Google's OAuth to work via the API client for Python.

https://developers.google.com/api-client-library/python/start/installation

I have used easy_setup to install it, and I have the apiclient packages in the same directory as my Python client. However, when I run my client, I get

from apiclient.discovery import build

from apiclient.errors import HttpError
ImportError: No module named errors

It looks like it can't find the errors.py class in the apiclient directory, but it is clearly there.

I have the packages included in my client:

from apiclient.discovery import build
from apiclient.http import MediaFileUpload
import httplib2
import mimetypes
from oauth2client.client import OAuth2WebServerFlow
from oauth2client.file import Storage as FileStorage
import oauth2client.tools

Is there a way around this?

Thanks.

like image 425
dacardzmasta Avatar asked May 01 '14 17:05

dacardzmasta


People also ask

What is Client_secret JSON?

A client_secrets.json file is a JSON formatted file containing the client ID, client secret, and other OAuth 2.0 parameters.

What is InstalledAppFlow?

InstalledAppFlow class is used for installed applications. This flow is useful for local development or applications that are installed on a desktop operating system. See OAuth 2.0 for Installed Applications. from google_auth_oauthlib.flow import InstalledAppFlow flow = InstalledAppFlow.


1 Answers

This sounds like a path problem.

From the command line in your OS, start the python binary:

user@/usr/bin python

You should see something like this:

Python 2.7.6 (default, Sep 9 2014, 15:04:36)

[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin

Type "help", "copyright", "credits" or "license" for more information.

Next import sys, then print sys.path:

import sys

sys.path

sys.path will show all the locations python is currently aware of to look for libraries. Confirm that the api client exists in one of those paths, and that the permissions on that path are correct.

Sharing a screenshot of the output from the above steps will help further diagnose your problem.

like image 133
Dan O'Boyle Avatar answered Sep 18 '22 19:09

Dan O'Boyle