Skip to content

Instantly share code, notes, and snippets.

@mcsquaredjr
Last active December 16, 2015 00:29
Show Gist options
  • Save mcsquaredjr/5348451 to your computer and use it in GitHub Desktop.
Save mcsquaredjr/5348451 to your computer and use it in GitHub Desktop.
install_gdata
# Install gdata and its samples.
# To use the library add it to the system path
# Due to some issues with cElementTree implementation, please visit __init__
# in the atom directory, comment out lines 47-56 and replace with the line:
#
# from xml.etree import ElementTree
# The same operation should also be done in core.py, lines 25-34.
#
# Otherwise gdata won't work correctly.
# Better yet, find all places in the library where it has lines:
#try:
# from xml.etree import cElementTree as ElementTree
#except ImportError:
# try:
# import cElementTree as ElementTree
# except ImportError:
# try:
# from xml.etree import ElementTree
# except ImportError:
# from elementtree import ElementTree
#
# And replace them with the next line:
#
# from xml.etree import ElementTree
# Thanks to Ole Zom for his help in figuring this out.
note = \
'''Due to some issues with cElementTree implementation, please visit __init__
in the atom directory, comment out lines 47-56 and replace with the line:
from xml.etree import ElementTree
The same operation should also be done in core.py, lines 25-34.
Otherwise gdata won't work correctly.
Thanks to Ole Zom for his help in figuring this out.
'''
import tarfile
import shutil
import urllib
import os
try:
os.mkdir('gdata')
except:
pass
print 'Downloading gdata-python-client...'
filename, headers = urllib.urlretrieve('https://gdata-python-client.googlecode.com/files/gdata-2.0.17.tar.gz')
print 'Installing gdata-python-client...'
t = tarfile.open(filename, 'r')
t.extractall()
t.close()
shutil.move('gdata-2.0.17/src/atom', 'gdata/atom')
shutil.move('gdata-2.0.17/src/gdata', 'gdata/gdata')
shutil.move('gdata-2.0.17/samples', 'gdata/samples')
shutil.move('gdata-2.0.17/tests', 'gdata/tests')
shutil.rmtree('gdata-2.0.17')
import editor
editor.reload_files()
print 'Done.\n\n'
print note
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment