我在代码中发现以下错误,有人可以指导我为什么我发现此错误以及如何解决它。
我在响应中使用响应之前记录了响应(json.dumps(response),content_type ='application / json',charset ='utf8'):-
[service_variant=lms][root][env:sandbox] WARNING [waleed-HP-Compaq-Elite-8300-CMT 32269] [mixins.py:75] - (json.dumps(response)-- {'url': u'/openassessment/fileupload/submissions_attachments/a419e1fff5e9a869a46d537c7ae3a18a/course-v1:edX+DemoX+Demo_Course/block-v1:edX+DemoX+Demo_Course+type@openassessment+block@051fae2bdc4f47929078eda8463a8c44/', 'success': True}
[service_variant = lms] [courseware.module_render] [env:sandbox]错误 [waleed-HP-Compaq-Elite-8300-CMT 32269] [module_render.py:1210]- 执行xblock处理程序时出错
Traceback (most recent call last):
File "/edx/app/edxapp/edx-platform/lms/djangoapps/courseware/module_render.py", line 1185, in _invoke_xblock_handler
resp = handler_instance.handle(handler, req, suffix)
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/xblock/mixins.py", line 91, in handle
return self.runtime.handle(self, handler_name, request, suffix)
File "/edx/app/edxapp/edx-platform/common/lib/xmodule/xmodule/x_module.py", line 1365, in handle
return super(MetricsMixin, self).handle(block, handler_name, request, suffix=suffix)
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/xblock/runtime.py", line 1037, in handle
results = handler(request, suffix)
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/xblock/mixins.py", line 76, in wrapper
return Response(json.dumps(response), content_type='application/json', charset='utf8')
File "/usr/lib/python2.7/json/__init__.py", line 244, in dumps
return _default_encoder.encode(obj)
File "/usr/lib/python2.7/json/encoder.py", line 207, in encode
chunks = self.iterencode(o, _one_shot=True)
File "/usr/lib/python2.7/json/encoder.py", line 270, in iterencode
return _iterencode(o, 0)
File "/usr/lib/python2.7/json/encoder.py", line 184, in default
raise TypeError(repr(o) + " is not JSON serializable")
错误:-
TypeError: u'/openassessment/fileupload/submissions_attachments/a419e1fff5e9a869a46d537c7ae3a18a/course-v1:edX+DemoX+Demo_Course/block-v1:edX+DemoX+Demo_Course+type@openassessment+block@051fae2bdc4f47929078eda8463a8c44/' is not JSON serializable