Hi,

We got an error when we used API to see a quota detail, we get the following traceback:


157.99.60.167 - - [08/Mar/2016:10:13:58 +0200] "GET /api/quotas HTTP/1.1" 200 - "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:44.0) Gecko/20100101 Firefox/44.0" galaxy.web.framework.decorators ERROR 2016-03-08 10:14:10,273 Uncaught exception in exposed API method:
Traceback (most recent call last):
  File ".../lib/galaxy/web/framework/decorators.py", line 142, in decorator
    rval = dumps( rval, indent=4, sort_keys=True )
  File ".../lib/galaxy/util/json.py", line 65, in safe_dumps
    dumped = json.dumps( *args, allow_nan=False, **kwargs )
  File "/usr/lib64/python2.6/json/__init__.py", line 237, in dumps
    **kw).encode(obj)
  File "/usr/lib64/python2.6/json/encoder.py", line 367, in encode
    chunks = list(self.iterencode(o))
  File "/usr/lib64/python2.6/json/encoder.py", line 309, in _iterencode
    for chunk in self._iterencode_dict(o, markers):
File "/usr/lib64/python2.6/json/encoder.py", line 275, in _iterencode_dict
    for chunk in self._iterencode(value, markers):
  File "/usr/lib64/python2.6/json/encoder.py", line 306, in _iterencode
    for chunk in self._iterencode_list(o, markers):
File "/usr/lib64/python2.6/json/encoder.py", line 204, in _iterencode_list
    for chunk in self._iterencode(value, markers):
  File "/usr/lib64/python2.6/json/encoder.py", line 309, in _iterencode
    for chunk in self._iterencode_dict(o, markers):
File "/usr/lib64/python2.6/json/encoder.py", line 275, in _iterencode_dict
    for chunk in self._iterencode(value, markers):
  File "/usr/lib64/python2.6/json/encoder.py", line 309, in _iterencode
    for chunk in self._iterencode_dict(o, markers):
File "/usr/lib64/python2.6/json/encoder.py", line 275, in _iterencode_dict
    for chunk in self._iterencode(value, markers):
  File "/usr/lib64/python2.6/json/encoder.py", line 317, in _iterencode
    for chunk in self._iterencode_default(o, markers):
File "/usr/lib64/python2.6/json/encoder.py", line 323, in _iterencode_default
    newobj = self.default(o)
  File "/usr/lib64/python2.6/json/encoder.py", line 344, in default
    raise TypeError(repr(o) + " is not JSON serializable")
TypeError: Decimal('856488698767') is not JSON serializable

json can't serialize Decimal object.
I tested it with simplejson and it works.
An other solution is to convert the Decimal object to a float before the dumps.

Thanks a lot for your help
Best regards,

--
Fabien Mareuil | Centre d'Informatique pour la Biologie
fabien.mare...@pasteur.fr <mailto:fabien.mare...@pasteur.fr> | Institut Pasteur
25,28 rue du Docteur Roux 75015 Paris, France

___________________________________________________________
Please keep all replies on the list by using "reply all"
in your mail client.  To manage your subscriptions to this
and other Galaxy lists, please use the interface at:
  https://lists.galaxyproject.org/

To search Galaxy mailing lists use the unified search at:
  http://galaxyproject.org/search/mailinglists/

Reply via email to