ids = cPickle.loads(gem.value) loads() argument 1 must be string, not unicode
You can fix it by making gem.value a string, not unicode.
gem.value
Use str(gem.value)
str(gem.value)