Reputation: 853
I'm using virtualenv with my application, and I've installed gdata, jira, and gspread using env/bin/pip install <lib name>
in terminal under my project folder. I'm following the documentation from the Google API but it is not working?
In the documentation, in order to do error handling you need to do:
from gdata import errors
And in order to create an instance of the Drive API service (in order to later on create a file) you need to do:
from gdata.discovery import build
However the files are different, there is no "discovery" or "errors" and when I run env/bin/python run.py
I get this error:
Traceback (most recent call last):
File "run.py", line 3, in <module>
from gdata import errors
ImportError: cannot import name errors
(same with discovery)
I thought that maybe they mean from apiclient import errors
literally in the documentation, so I tried pip installing apiclient and replacing gdata with apiclient but it still does not work.
I downloaded the gdata.zip file and unzipped it and looked through the sample code (especially for spreadsheet since that's what I'm trying to create) and they take a very different approach than the documentation and I'm very confused. My goal is to use their API to just create a spreadsheet from the code, but I do not plan on using their API to edit the spreadsheet itself, I plan on using gspread (Github).
I've done a lot of research and I've been directed to a lot of different places and I might have perhaps mixed up the code? Does anyone know what I did wrong/have a fix? A huge thanks in advance.
Upvotes: 0
Views: 1098
Reputation: 37023
This kind of import error is usually caused by the user installing another module of the same name. Do you by any chance have a gdata.py
somehwere on your Python path?
You can verify whether this is causing the issue by:
import gdata
print gdata.__file__
This tells you where the interpreter is loading the code from.
Upvotes: 1