daily pastebin goal
43%
SHARE
TWEET

erro_survey

a guest Aug 20th, 2018 69 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
  1. TypeError
  2.  
  3. TypeError: AttributeError("'NoneType' object has no attribute 'decode'",) is not JSON serializable
  4.  
  5. Traceback (most recent call last)
  6.  
  7. File "/root/api-horus-flask/venv/lib/python2.7/site-packages/flask/app.py", line 1997, in __call__
  8.  
  9.                 error = None
  10.             ctx.auto_pop(error)
  11.  
  12.     def __call__(self, environ, start_response):
  13.         """Shortcut for :attr:`wsgi_app`."""
  14.         return self.wsgi_app(environ, start_response)
  15.  
  16.     def __repr__(self):
  17.         return '<%s %r>' % (
  18.             self.__class__.__name__,
  19.             self.name,
  20. File "/root/api-horus-flask/venv/lib/python2.7/site-packages/flask/app.py", line 1985, in wsgi_app
  21.  
  22.         try:
  23.             try:
  24.                 response = self.full_dispatch_request()
  25.             except Exception as e:
  26.                 error = e
  27.                 response = self.handle_exception(e)
  28.             except:
  29.                 error = sys.exc_info()[1]
  30.                 raise
  31.             return response(environ, start_response)
  32.         finally:
  33. File "/root/api-horus-flask/venv/lib/python2.7/site-packages/flask/app.py", line 1540, in handle_exception
  34.  
  35.             # if we want to repropagate the exception, we can attempt to
  36.             # raise it with the whole traceback in case we can do that
  37.             # (the function was actually called from the except part)
  38.             # otherwise, we just raise the error again
  39.             if exc_value is e:
  40.                 reraise(exc_type, exc_value, tb)
  41.             else:
  42.                 raise e
  43.  
  44.         self.log_exception((exc_type, exc_value, tb))
  45.         if handler is None:
  46. File "/root/api-horus-flask/venv/lib/python2.7/site-packages/flask/app.py", line 1982, in wsgi_app
  47.  
  48.         ctx = self.request_context(environ)
  49.         ctx.push()
  50.         error = None
  51.         try:
  52.             try:
  53.                 response = self.full_dispatch_request()
  54.             except Exception as e:
  55.                 error = e
  56.                 response = self.handle_exception(e)
  57.             except:
  58.                 error = sys.exc_info()[1]
  59. File "/root/api-horus-flask/venv/lib/python2.7/site-packages/flask/app.py", line 1614, in full_dispatch_request
  60.  
  61.             request_started.send(self)
  62.             rv = self.preprocess_request()
  63.             if rv is None:
  64.                 rv = self.dispatch_request()
  65.         except Exception as e:
  66.             rv = self.handle_user_exception(e)
  67.         return self.finalize_request(rv)
  68.  
  69.     def finalize_request(self, rv, from_error_handler=False):
  70.         """Given the return value from a view function this finalizes
  71.         the request by converting it into a response and invoking the
  72. File "/root/api-horus-flask/venv/lib/python2.7/site-packages/flask/app.py", line 1517, in handle_user_exception
  73.  
  74.             return self.handle_http_exception(e)
  75.  
  76.         handler = self._find_error_handler(e)
  77.  
  78.         if handler is None:
  79.             reraise(exc_type, exc_value, tb)
  80.         return handler(e)
  81.  
  82.     def handle_exception(self, e):
  83.         """Default exception handling that kicks in when an exception
  84.         occurs that is not caught.  In debug mode the exception will
  85. File "/root/api-horus-flask/venv/lib/python2.7/site-packages/flask/app.py", line 1612, in full_dispatch_request
  86.  
  87.         self.try_trigger_before_first_request_functions()
  88.         try:
  89.             request_started.send(self)
  90.             rv = self.preprocess_request()
  91.             if rv is None:
  92.                 rv = self.dispatch_request()
  93.         except Exception as e:
  94.             rv = self.handle_user_exception(e)
  95.         return self.finalize_request(rv)
  96.  
  97.     def finalize_request(self, rv, from_error_handler=False):
  98. File "/root/api-horus-flask/venv/lib/python2.7/site-packages/flask/app.py", line 1598, in dispatch_request
  99.  
  100.         # request came with the OPTIONS method, reply automatically
  101.         if getattr(rule, 'provide_automatic_options', False) \
  102.            and req.method == 'OPTIONS':
  103.             return self.make_default_options_response()
  104.         # otherwise dispatch to the handler for that endpoint
  105.         return self.view_functions[rule.endpoint](**req.view_args)
  106.  
  107.     def full_dispatch_request(self):
  108.         """Dispatches the request and on top of that performs request
  109.         pre and postprocessing as well as HTTP exception catching and
  110.         error handling.
  111. File "/root/api-horus-flask/project/app.py", line 288, in survey
  112.  
  113.         if res['response']:
  114.             response = {'code': 200, 'status_mensagem': 'Missões carregadas com sucesso', 'result': res['result'], 'zones_to_user': res['zones_to_user']}
  115.         else:
  116.             response = {'code': 500, 'status_mensagem': 'Erro ao carregar missões', 'result': res['result'], 'zones_to_user': res['zones_to_user']}
  117.  
  118.         return Response(json.dumps(response, ensure_ascii=False), mimetype='application/json'), response['code'], header
  119.  
  120.     @app.route('/v1/interview/start/<id_survey>', methods=['POST'])
  121.     # @auth_token_required
  122.     def interview_start(id_survey):
  123.         user = UserService()
  124. File "/root/api-horus-flask/venv/lib/python2.7/site-packages/flask/json.py", line 123, in dumps
  125.  
  126.     default is controlled by the ``JSON_AS_ASCII`` configuration variable
  127.     and can be overridden by the simplejson ``ensure_ascii`` parameter.
  128.     """
  129.     _dump_arg_defaults(kwargs)
  130.     encoding = kwargs.pop('encoding', None)
  131.     rv = _json.dumps(obj, **kwargs)
  132.     if encoding is not None and isinstance(rv, text_type):
  133.         rv = rv.encode(encoding)
  134.     return rv
  135.  
  136.  
  137. File "/usr/lib/python2.7/json/__init__.py", line 251, in dumps
  138.  
  139.         cls = JSONEncoder
  140.     return cls(
  141.         skipkeys=skipkeys, ensure_ascii=ensure_ascii,
  142.         check_circular=check_circular, allow_nan=allow_nan, indent=indent,
  143.         separators=separators, encoding=encoding, default=default,
  144.         sort_keys=sort_keys, **kw).encode(obj)
  145.  
  146.  
  147. _default_decoder = JSONDecoder(encoding=None, object_hook=None,
  148.                                object_pairs_hook=None)
  149.  
  150. File "/usr/lib/python2.7/json/encoder.py", line 209, in encode
  151.  
  152.         # This doesn't pass the iterator directly to ''.join() because the
  153.         # exceptions aren't as detailed.  The list call should be roughly
  154.         # equivalent to the PySequence_Fast that ''.join() would do.
  155.         chunks = self.iterencode(o, _one_shot=True)
  156.         if not isinstance(chunks, (list, tuple)):
  157.             chunks = list(chunks)
  158.         return ''.join(chunks)
  159.  
  160.     def iterencode(self, o, _one_shot=False):
  161.         """Encode the given object and yield each string
  162.         representation as available.
  163. File "/usr/lib/python2.7/json/encoder.py", line 434, in _iterencode
  164.  
  165.             yield _floatstr(o)
  166.         elif isinstance(o, (list, tuple)):
  167.             for chunk in _iterencode_list(o, _current_indent_level):
  168.                 yield chunk
  169.         elif isinstance(o, dict):
  170.             for chunk in _iterencode_dict(o, _current_indent_level):
  171.                 yield chunk
  172.         else:
  173.             if markers is not None:
  174.                 markerid = id(o)
  175.                 if markerid in markers:
  176. File "/usr/lib/python2.7/json/encoder.py", line 408, in _iterencode_dict
  177.  
  178.                     chunks = _iterencode_list(value, _current_indent_level)
  179.                 elif isinstance(value, dict):
  180.                     chunks = _iterencode_dict(value, _current_indent_level)
  181.                 else:
  182.                     chunks = _iterencode(value, _current_indent_level)
  183.                 for chunk in chunks:
  184.                     yield chunk
  185.         if newline_indent is not None:
  186.             _current_indent_level -= 1
  187.             yield '\n' + (' ' * (_indent * _current_indent_level))
  188.         yield '}'
  189. File "/usr/lib/python2.7/json/encoder.py", line 442, in _iterencode
  190.  
  191.             if markers is not None:
  192.                 markerid = id(o)
  193.                 if markerid in markers:
  194.                     raise ValueError("Circular reference detected")
  195.                 markers[markerid] = o
  196.             o = _default(o)
  197.             for chunk in _iterencode(o, _current_indent_level):
  198.                 yield chunk
  199.             if markers is not None:
  200.                 del markers[markerid]
  201.  
  202. File "/root/api-horus-flask/venv/lib/python2.7/site-packages/flask/json.py", line 80, in default
  203.  
  204.             return http_date(o.timetuple())
  205.         if isinstance(o, uuid.UUID):
  206.             return str(o)
  207.         if hasattr(o, '__html__'):
  208.             return text_type(o.__html__())
  209.         return _json.JSONEncoder.default(self, o)
  210.  
  211.  
  212. class JSONDecoder(_json.JSONDecoder):
  213.     """The default JSON decoder.  This one does not change the behavior from
  214.     the default simplejson decoder.  Consult the :mod:`json` documentation
  215. File "/usr/lib/python2.7/json/encoder.py", line 184, in default
  216.  
  217.                     return list(iterable)
  218.                 # Let the base class default method raise the TypeError
  219.                 return JSONEncoder.default(self, o)
  220.  
  221.         """
  222.         raise TypeError(repr(o) + " is not JSON serializable")
  223.  
  224.     def encode(self, o):
  225.         """Return a JSON string representation of a Python data structure.
  226.  
  227.         >>> JSONEncoder().encode({"foo": ["bar", "baz"]})
  228. TypeError: AttributeError("'NoneType' object has no attribute 'decode'",) is not JSON serializable
  229. This is the Copy/Paste friendly version of the traceback. You can also paste this traceback into a gist:  create paste
  230.  
  231.  
  232. Traceback (most recent call last):
  233.   File "/root/api-horus-flask/venv/lib/python2.7/site-packages/flask/app.py", line 1997, in __call__
  234.     return self.wsgi_app(environ, start_response)
  235.   File "/root/api-horus-flask/venv/lib/python2.7/site-packages/flask/app.py", line 1985, in wsgi_app
  236.     response = self.handle_exception(e)
  237.   File "/root/api-horus-flask/venv/lib/python2.7/site-packages/flask/app.py", line 1540, in handle_exception
  238.     reraise(exc_type, exc_value, tb)
  239.   File "/root/api-horus-flask/venv/lib/python2.7/site-packages/flask/app.py", line 1982, in wsgi_app
  240.     response = self.full_dispatch_request()
  241.   File "/root/api-horus-flask/venv/lib/python2.7/site-packages/flask/app.py", line 1614, in full_dispatch_request
  242.     rv = self.handle_user_exception(e)
  243.   File "/root/api-horus-flask/venv/lib/python2.7/site-packages/flask/app.py", line 1517, in handle_user_exception
  244.     reraise(exc_type, exc_value, tb)
  245.   File "/root/api-horus-flask/venv/lib/python2.7/site-packages/flask/app.py", line 1612, in full_dispatch_request
  246.     rv = self.dispatch_request()
  247.   File "/root/api-horus-flask/venv/lib/python2.7/site-packages/flask/app.py", line 1598, in dispatch_request
  248.     return self.view_functions[rule.endpoint](**req.view_args)
  249.   File "/root/api-horus-flask/project/app.py", line 288, in survey
  250.     return Response(json.dumps(response, ensure_ascii=False), mimetype='application/json'), response['code'], header
  251.   File "/root/api-horus-flask/venv/lib/python2.7/site-packages/flask/json.py", line 123, in dumps
  252.     rv = _json.dumps(obj, **kwargs)
  253.   File "/usr/lib/python2.7/json/__init__.py", line 251, in dumps
  254.     sort_keys=sort_keys, **kw).encode(obj)
  255.   File "/usr/lib/python2.7/json/encoder.py", line 209, in encode
  256.     chunks = list(chunks)
  257.   File "/usr/lib/python2.7/json/encoder.py", line 434, in _iterencode
  258.     for chunk in _iterencode_dict(o, _current_indent_level):
  259.   File "/usr/lib/python2.7/json/encoder.py", line 408, in _iterencode_dict
  260.     for chunk in chunks:
  261.   File "/usr/lib/python2.7/json/encoder.py", line 442, in _iterencode
  262.     o = _default(o)
  263.   File "/root/api-horus-flask/venv/lib/python2.7/site-packages/flask/json.py", line 80, in default
  264.     return _json.JSONEncoder.default(self, o)
  265.   File "/usr/lib/python2.7/json/encoder.py", line 184, in default
  266.     raise TypeError(repr(o) + " is not JSON serializable")
  267. TypeError: AttributeError("'NoneType' object has no attribute 'decode'",) is not JSON serializable
  268. The debugger caught an exception in your WSGI application. You can now look at the traceback which led to the error. If you enable JavaScript you can also use additional features such as code execution (if the evalex feature is enabled), automatic pasting of the exceptions and much more.
  269. Brought to you by DON'T PANIC, your friendly Werkzeug powered traceback interpreter.
  270. Console Locked
  271.  
  272. The console is locked and needs to be unlocked by entering the PIN. You can find the PIN printed out on the standard output of your shell that runs the server.
  273.  
  274. PIN:  
  275.   Confirm Pin
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top