Search code examples
pythonyoutubegdata

Can't import gdata.youtube.service


These work fine

import gdata 
import gdata.youtube 

but when I try

from gdata.youtube import service as something

I get this error:

Traceback (most recent call last):   
  File "<stdin>", line 1, in <module>   
  File "/usr/lib/python2.7/dist-packages/spyderlib/widgets/externalshell/sitecustomize.py", line 540, in runfile
    execfile(filename, namespace)   
  File "/home/dimitris/untitled1.py", line 8, in <module>
    import gdata.youtube.service   
  File "/home/dimitris/anaconda/lib/python2.7/site-packages/gdata/youtube/service.py", line 39, in <module>
    import gdata.service   
  File "/home/dimitris/anaconda/lib/python2.7/site-packages/gdata/service.py", line 76, in <module>
    import atom.service 
  File "/home/dimitris/anaconda/lib/python2.7/site-packages/atom/service.py", line 33, in <module>
    import atom.http_interface ImportError: No module named http_interface

Any advice?


Solution

  • Looks like the gdata package also includes the "atom" package as well. I'm guessing that you might have downloaded the package and extracted it (from .zip or .tar.gz) which might be causing import issues.

    Instead, delete your downloaded package and try using pip to install the package by running pip install gdata, the atom package will get installed as well and everything will work fine. If you don't have pip, you can install it here: http://pip.readthedocs.org/en/latest/installing.html

    Alternatively, you can also do a local install if you have the tarball by running pip install ~/my_path/gdata-2.0.18.tar.gz

    If you already have the package installed, you may have to use the --upgrade flag to install the latest version of the package.