Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- TypeError
- TypeError: AttributeError("'NoneType' object has no attribute 'decode'",) is not JSON serializable
- Traceback (most recent call last)
- File "/root/api-horus-flask/venv/lib/python2.7/site-packages/flask/app.py", line 1997, in __call__
- error = None
- ctx.auto_pop(error)
- def __call__(self, environ, start_response):
- """Shortcut for :attr:`wsgi_app`."""
- return self.wsgi_app(environ, start_response)
- def __repr__(self):
- return '<%s %r>' % (
- self.__class__.__name__,
- self.name,
- File "/root/api-horus-flask/venv/lib/python2.7/site-packages/flask/app.py", line 1985, in wsgi_app
- try:
- try:
- response = self.full_dispatch_request()
- except Exception as e:
- error = e
- response = self.handle_exception(e)
- except:
- error = sys.exc_info()[1]
- raise
- return response(environ, start_response)
- finally:
- File "/root/api-horus-flask/venv/lib/python2.7/site-packages/flask/app.py", line 1540, in handle_exception
- # if we want to repropagate the exception, we can attempt to
- # raise it with the whole traceback in case we can do that
- # (the function was actually called from the except part)
- # otherwise, we just raise the error again
- if exc_value is e:
- reraise(exc_type, exc_value, tb)
- else:
- raise e
- self.log_exception((exc_type, exc_value, tb))
- if handler is None:
- File "/root/api-horus-flask/venv/lib/python2.7/site-packages/flask/app.py", line 1982, in wsgi_app
- ctx = self.request_context(environ)
- ctx.push()
- error = None
- try:
- try:
- response = self.full_dispatch_request()
- except Exception as e:
- error = e
- response = self.handle_exception(e)
- except:
- error = sys.exc_info()[1]
- File "/root/api-horus-flask/venv/lib/python2.7/site-packages/flask/app.py", line 1614, in full_dispatch_request
- request_started.send(self)
- rv = self.preprocess_request()
- if rv is None:
- rv = self.dispatch_request()
- except Exception as e:
- rv = self.handle_user_exception(e)
- return self.finalize_request(rv)
- def finalize_request(self, rv, from_error_handler=False):
- """Given the return value from a view function this finalizes
- the request by converting it into a response and invoking the
- File "/root/api-horus-flask/venv/lib/python2.7/site-packages/flask/app.py", line 1517, in handle_user_exception
- return self.handle_http_exception(e)
- handler = self._find_error_handler(e)
- if handler is None:
- reraise(exc_type, exc_value, tb)
- return handler(e)
- def handle_exception(self, e):
- """Default exception handling that kicks in when an exception
- occurs that is not caught. In debug mode the exception will
- File "/root/api-horus-flask/venv/lib/python2.7/site-packages/flask/app.py", line 1612, in full_dispatch_request
- self.try_trigger_before_first_request_functions()
- try:
- request_started.send(self)
- rv = self.preprocess_request()
- if rv is None:
- rv = self.dispatch_request()
- except Exception as e:
- rv = self.handle_user_exception(e)
- return self.finalize_request(rv)
- def finalize_request(self, rv, from_error_handler=False):
- File "/root/api-horus-flask/venv/lib/python2.7/site-packages/flask/app.py", line 1598, in dispatch_request
- # request came with the OPTIONS method, reply automatically
- if getattr(rule, 'provide_automatic_options', False) \
- and req.method == 'OPTIONS':
- return self.make_default_options_response()
- # otherwise dispatch to the handler for that endpoint
- return self.view_functions[rule.endpoint](**req.view_args)
- def full_dispatch_request(self):
- """Dispatches the request and on top of that performs request
- pre and postprocessing as well as HTTP exception catching and
- error handling.
- File "/root/api-horus-flask/project/app.py", line 288, in survey
- if res['response']:
- response = {'code': 200, 'status_mensagem': 'Missões carregadas com sucesso', 'result': res['result'], 'zones_to_user': res['zones_to_user']}
- else:
- response = {'code': 500, 'status_mensagem': 'Erro ao carregar missões', 'result': res['result'], 'zones_to_user': res['zones_to_user']}
- return Response(json.dumps(response, ensure_ascii=False), mimetype='application/json'), response['code'], header
- @app.route('/v1/interview/start/<id_survey>', methods=['POST'])
- # @auth_token_required
- def interview_start(id_survey):
- user = UserService()
- File "/root/api-horus-flask/venv/lib/python2.7/site-packages/flask/json.py", line 123, in dumps
- default is controlled by the ``JSON_AS_ASCII`` configuration variable
- and can be overridden by the simplejson ``ensure_ascii`` parameter.
- """
- _dump_arg_defaults(kwargs)
- encoding = kwargs.pop('encoding', None)
- rv = _json.dumps(obj, **kwargs)
- if encoding is not None and isinstance(rv, text_type):
- rv = rv.encode(encoding)
- return rv
- File "/usr/lib/python2.7/json/__init__.py", line 251, in dumps
- cls = JSONEncoder
- return cls(
- skipkeys=skipkeys, ensure_ascii=ensure_ascii,
- check_circular=check_circular, allow_nan=allow_nan, indent=indent,
- separators=separators, encoding=encoding, default=default,
- sort_keys=sort_keys, **kw).encode(obj)
- _default_decoder = JSONDecoder(encoding=None, object_hook=None,
- object_pairs_hook=None)
- File "/usr/lib/python2.7/json/encoder.py", line 209, in encode
- # This doesn't pass the iterator directly to ''.join() because the
- # exceptions aren't as detailed. The list call should be roughly
- # equivalent to the PySequence_Fast that ''.join() would do.
- chunks = self.iterencode(o, _one_shot=True)
- if not isinstance(chunks, (list, tuple)):
- chunks = list(chunks)
- return ''.join(chunks)
- def iterencode(self, o, _one_shot=False):
- """Encode the given object and yield each string
- representation as available.
- File "/usr/lib/python2.7/json/encoder.py", line 434, in _iterencode
- yield _floatstr(o)
- elif isinstance(o, (list, tuple)):
- for chunk in _iterencode_list(o, _current_indent_level):
- yield chunk
- elif isinstance(o, dict):
- for chunk in _iterencode_dict(o, _current_indent_level):
- yield chunk
- else:
- if markers is not None:
- markerid = id(o)
- if markerid in markers:
- File "/usr/lib/python2.7/json/encoder.py", line 408, in _iterencode_dict
- chunks = _iterencode_list(value, _current_indent_level)
- elif isinstance(value, dict):
- chunks = _iterencode_dict(value, _current_indent_level)
- else:
- chunks = _iterencode(value, _current_indent_level)
- for chunk in chunks:
- yield chunk
- if newline_indent is not None:
- _current_indent_level -= 1
- yield '\n' + (' ' * (_indent * _current_indent_level))
- yield '}'
- File "/usr/lib/python2.7/json/encoder.py", line 442, in _iterencode
- if markers is not None:
- markerid = id(o)
- if markerid in markers:
- raise ValueError("Circular reference detected")
- markers[markerid] = o
- o = _default(o)
- for chunk in _iterencode(o, _current_indent_level):
- yield chunk
- if markers is not None:
- del markers[markerid]
- File "/root/api-horus-flask/venv/lib/python2.7/site-packages/flask/json.py", line 80, in default
- return http_date(o.timetuple())
- if isinstance(o, uuid.UUID):
- return str(o)
- if hasattr(o, '__html__'):
- return text_type(o.__html__())
- return _json.JSONEncoder.default(self, o)
- class JSONDecoder(_json.JSONDecoder):
- """The default JSON decoder. This one does not change the behavior from
- the default simplejson decoder. Consult the :mod:`json` documentation
- File "/usr/lib/python2.7/json/encoder.py", line 184, in default
- return list(iterable)
- # Let the base class default method raise the TypeError
- return JSONEncoder.default(self, o)
- """
- raise TypeError(repr(o) + " is not JSON serializable")
- def encode(self, o):
- """Return a JSON string representation of a Python data structure.
- >>> JSONEncoder().encode({"foo": ["bar", "baz"]})
- TypeError: AttributeError("'NoneType' object has no attribute 'decode'",) is not JSON serializable
- This is the Copy/Paste friendly version of the traceback. You can also paste this traceback into a gist: create paste
- Traceback (most recent call last):
- File "/root/api-horus-flask/venv/lib/python2.7/site-packages/flask/app.py", line 1997, in __call__
- return self.wsgi_app(environ, start_response)
- File "/root/api-horus-flask/venv/lib/python2.7/site-packages/flask/app.py", line 1985, in wsgi_app
- response = self.handle_exception(e)
- File "/root/api-horus-flask/venv/lib/python2.7/site-packages/flask/app.py", line 1540, in handle_exception
- reraise(exc_type, exc_value, tb)
- File "/root/api-horus-flask/venv/lib/python2.7/site-packages/flask/app.py", line 1982, in wsgi_app
- response = self.full_dispatch_request()
- File "/root/api-horus-flask/venv/lib/python2.7/site-packages/flask/app.py", line 1614, in full_dispatch_request
- rv = self.handle_user_exception(e)
- File "/root/api-horus-flask/venv/lib/python2.7/site-packages/flask/app.py", line 1517, in handle_user_exception
- reraise(exc_type, exc_value, tb)
- File "/root/api-horus-flask/venv/lib/python2.7/site-packages/flask/app.py", line 1612, in full_dispatch_request
- rv = self.dispatch_request()
- File "/root/api-horus-flask/venv/lib/python2.7/site-packages/flask/app.py", line 1598, in dispatch_request
- return self.view_functions[rule.endpoint](**req.view_args)
- File "/root/api-horus-flask/project/app.py", line 288, in survey
- return Response(json.dumps(response, ensure_ascii=False), mimetype='application/json'), response['code'], header
- File "/root/api-horus-flask/venv/lib/python2.7/site-packages/flask/json.py", line 123, in dumps
- rv = _json.dumps(obj, **kwargs)
- File "/usr/lib/python2.7/json/__init__.py", line 251, in dumps
- sort_keys=sort_keys, **kw).encode(obj)
- File "/usr/lib/python2.7/json/encoder.py", line 209, in encode
- chunks = list(chunks)
- File "/usr/lib/python2.7/json/encoder.py", line 434, in _iterencode
- for chunk in _iterencode_dict(o, _current_indent_level):
- File "/usr/lib/python2.7/json/encoder.py", line 408, in _iterencode_dict
- for chunk in chunks:
- File "/usr/lib/python2.7/json/encoder.py", line 442, in _iterencode
- o = _default(o)
- File "/root/api-horus-flask/venv/lib/python2.7/site-packages/flask/json.py", line 80, in default
- return _json.JSONEncoder.default(self, o)
- File "/usr/lib/python2.7/json/encoder.py", line 184, in default
- raise TypeError(repr(o) + " is not JSON serializable")
- TypeError: AttributeError("'NoneType' object has no attribute 'decode'",) is not JSON serializable
- 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.
- Brought to you by DON'T PANIC, your friendly Werkzeug powered traceback interpreter.
- Console Locked
- 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.
- PIN:
- Confirm Pin
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement