This is not the problem. The problem is that web2py calls json.dumps(..., 
default=....)
This API is supported by both json and by simplejson (which ships with 
web2py). The problem is that you have another version of simplejson 
installed. An older version that does not support this API.

You should uninstall is

    pip uninstall simplejson

The web2py change was motivated by this:
http://stackoverflow.com/questions/712791/what-are-the-differences-between-json-and-simplejson-python-modules

because people usually install simplejson to have a newer version of json, 
not an older version. ;-)


On Sunday, 27 October 2013 23:24:25 UTC-5, arutti wrote:
>
> Hello,
>
> This is a json error which doesn't occur on my dev. system Windows 7, 
> same version of web2py and python2.7
>
> web2py™Version 2.7.4-stable+timestamp.2013.10.14.15.16.29PythonPython 
> 2.6.6: /usr/languages/python/2.6/bin/python (prefix: 
> /usr/languages/python/2.6)Traceback
>
> 1.
> 2.
> 3.
> 4.
> 5.
> 6.
> 7.
> 8.
> 9.
> 10.
> 11.
> 12.
> 13.
> 14.
> 15.
> 16.
> 17.
> 18.
> 19.
> 20.
>
> Traceback (most recent call last):
>   File "/home/my_site/web2py/gluon/restricted.py", line 217, in restricted
>     exec ccode in environment
>   File "/home/my_site/web2py/applications/gps_/controllers/gprs.py", line 
> 126, in <module>
>   File "/home/my_site/web2py/gluon/globals.py", line 372, in <lambda>
>     self._caller = lambda f: f()
>   File "/home/my_site/web2py/applications/gps_/controllers/gprs.py", line 46, 
> in call
>     def call(): return service()
>   File "/home/my_site/web2py/gluon/tools.py", line 4913, in __call__
>     return self.serve_json(request.args[1:])
>   File "/home/my_site/web2py/gluon/tools.py", line 4604, in serve_json
>     return response.json(s)
>   File "/home/my_site/web2py/gluon/globals.py", line 598, in json
>     return json(data, default=default or custom_json)
>   File "/home/my_site/web2py/gluon/serializers.py", line 124, in json
>     default=default).replace(ur'\u2028',
>   File "/usr/local/lib/python2.6/site-packages/simplejson/__init__.py", line 
> 216, in dumps
>     **kw).encode(obj)
> TypeError: __init__() got an unexpected keyword argument 'default'
>
>
>
>
> This issue raises when I upgraded from web2py-1.99.4 to 2.7.4
>
> To fix the problem, I modified the import of json in gluon/serializers.psto 
> what it was in 1.99.4 and it works :-)
>
> 2.7.4
> try:
>     import simplejson as json_parser                # try external module
> except ImportError:
>     try:
>         import json as json_parser                  # try stdlib (Python 
> >= 2.6)
>     except:
>         import gluon.contrib.simplejson as json_parser    # fallback to 
> pure-Python module
>
> 1.99.4
> try:
>     import json as json_parser                      # try stdlib (Python 
> 2.6)
> except ImportError:
>     try:
>         import simplejson as json_parser            # try external module
>     except:
>         import contrib.simplejson as json_parser    # fallback to 
> pure-Python module
>
>
> Of course this fix it not satisfactory, because I will have to apply this 
> modification every time I upgrade web2py.
> Also I'd like to understand why the problem raises.
>
> Thanks and regards
> Andre
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to