Search code examples
pythonunixgoogle-apigoogle-calendar-apigdata-api

Gdata API Installation


I have no idea what I'm doing. I'm using Python 2.7 on OSX with the Eclipse PyDev IDE. I've never worked with an API before, but I need to use the google calendar API with a Python application I'm developing. I downloaded the latest gdata module from Google and installed it using this line in Terminal while in the directory into which I downloaded the gdata folder (Downloads):

sudo python setup.py install

It seemed to install everything into a Python directory deep within my machine's Library, no errors were given. However, now when I attempt to run a program with the following import commands:

import gdata.calendar.data
import gdata.calendar.client
import gdata.acl.data
import atom

I get the following error:

ImportError: No module named gdata.calendar.data

Clearly indicating I have done something wrong on the install. Thoughts?


Solution

  • It's probably installed, but you haven't told Eclipse where to look for gdata.

    Right click on the project in Eclipse and choose Properties -> PyDev - PYTHONPATH -> Source Folders and click "Add source folder".

    The folder will (probably) be in /Library/Python/2.7/site-packages/gdata, depending on the version and where you installed it. It might be somewhere else, like dist-packages instead of site-packages, but once you find it and add the folder inside Eclipse, the imports should work.

    Edit: Don't forget to do the same for atom, too.