From 9e2198e1154871dfe4bbd466e79551f8d4fce2a9 Mon Sep 17 00:00:00 2001 From: Jay Lee Date: Wed, 19 Nov 2014 11:49:46 -0500 Subject: [PATCH] convert to string before urldecode --- gam.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gam.py b/gam.py index e2677ad5..3fad1d53 100644 --- a/gam.py +++ b/gam.py @@ -1508,7 +1508,7 @@ def doPhoto(users): import urllib2 try: f = urllib2.urlopen(filename) - image_data = f.read() + image_data = str(f.read()) except urllib2.HTTPError, e: print e continue @@ -1542,7 +1542,8 @@ def getPhoto(users): print u' no photo for %s' % user continue try: - photo_data = photo[u'photoData'] + photo_data = str(photo[u'photoData']) + print photo_data photo_data = base64.urlsafe_b64decode(photo_data) except KeyError: print u' no photo for %s' % user