carolinux / gdata-python-client

Automatically exported from code.google.com/p/gdata-python-client
0 stars 1 forks source link

Error in gauth.py for Python 2.4.3 for JSON #619

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Using gdata-2.0.17 on CentOS with Python 2.4.3, installed simplejson via 
easy_install (easy_install simplejson)
2. After install of gdata, ran the test script python gtest.py which fialed
3. Error in your library here:
/usr/lib/python2.4/site-packages/gdata/gauth.py
line 66: 
4. See resolution below

What is the expected output? What do you see instead?

root@sea [~]# python gtest.py
Traceback (most recent call last):
  File "gtest.py", line 1, in ?
    import gdata.docs.service
  File "/usr/lib/python2.4/site-packages/gdata/docs/service.py", line 34, in ?
    import gdata.service
  File "/usr/lib/python2.4/site-packages/gdata/service.py", line 81, in ?
    import gdata.auth
  File "/usr/lib/python2.4/site-packages/gdata/auth.py", line 39, in ?
    import gdata.gauth
  File "/usr/lib/python2.4/site-packages/gdata/gauth.py", line 66, in ?
    import json as simplejson
ImportError: No module named json

Resolution:
Change this block

try:
  import simplejson
  from simplejson.decoder import JSONDecodeError
except ImportError:
  JSONDecodeError = None
  try:
    # Try to import from django, should work on App Engine
    from django.utils import simplejson
  except ImportError:
    # Should work for Python2.6 and higher.
    import json as simplejson

TO THIS:

try:
  import simplejson
  from simplejson.decoder import JSONDecodeError
except ImportError:
  JSONDecodeError = None
  try:
    # Try to import from django, should work on App Engine
    from django.utils import simplejson
  except ImportError:
    # Should work for Python2.6 and higher.
    #import json as simplejson
    import simplejson as json

Works fine now.

Thanks,
Steve

Original issue reported on code.google.com by leggetts...@gmail.com on 22 May 2012 at 3:36

GoogleCodeExporter commented 9 years ago
I tried this, but got a similar error.  I have 2.43 but I don't think json or 
simplejson are installed anywhere.  Where can I download either of these so it 
will work with my 2.43?

Original comment by gary.m.r...@gmail.com on 19 Sep 2012 at 1:24

GoogleCodeExporter commented 9 years ago
Try running the command:
easy_install simplejson

Original comment by leggetts...@gmail.com on 19 Sep 2012 at 11:10

GoogleCodeExporter commented 9 years ago
I'm on a unix system which doesn't have easy_install.  Would you know how I can 
do this on unix?

Thanks.

Original comment by gary.m.r...@gmail.com on 19 Sep 2012 at 12:16

GoogleCodeExporter commented 9 years ago
Think you need setuptools first:
http://pypi.python.org/pypi/setuptools

Original comment by leggetts...@gmail.com on 19 Sep 2012 at 2:00

GoogleCodeExporter commented 9 years ago
I confirm Steve solution works.
Is this a bug?
My configuration is: python 2.4.6, gdata 2.0.17

Original comment by m.celo...@gmail.com on 12 Nov 2012 at 11:47