Python 3.x 类型为'的对象;未定义';不支持JSON序列化错误

Python 3.x 类型为'的对象;未定义';不支持JSON序列化错误,python-3.x,flask,jinja2,airflow,Python 3.x,Flask,Jinja2,Airflow,我有以下错误,我完全不理解: ERROR - Exception on /admin/airflow/ [GET] Traceback (most recent call last): File "/Users/account/Desktop/virtualenvs/project/lib/python3.6/site-packages/flask/app.py", line 2447, in wsgi_app response = self.full_

我有以下错误,我完全不理解:

     ERROR - Exception on /admin/airflow/ [GET]
Traceback (most recent call last):
  File "/Users/account/Desktop/virtualenvs/project/lib/python3.6/site-packages/flask/app.py", line 2447, in wsgi_app
    response = self.full_dispatch_request()
  File "/Users/account/Desktop/virtualenvs/project/lib/python3.6/site-packages/flask/app.py", line 1952, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/Users/account/Desktop/virtualenvs/project/lib/python3.6/site-packages/flask/app.py", line 1821, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/Users/account/Desktop/virtualenvs/project/lib/python3.6/site-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/Users/account/Desktop/virtualenvs/project/lib/python3.6/site-packages/flask/app.py", line 1950, in full_dispatch_request
    rv = self.dispatch_request()
  File "/Users/account/Desktop/virtualenvs/project/lib/python3.6/site-packages/flask/app.py", line 1936, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/Users/account/Desktop/virtualenvs/project/lib/python3.6/site-packages/flask_admin/base.py", line 69, in inner
    return self._run_view(f, *args, **kwargs)
  File "/Users/account/Desktop/virtualenvs/project/lib/python3.6/site-packages/flask_admin/base.py", line 368, in _run_view
    return fn(self, *args, **kwargs)
  File "/Users/account/Desktop/virtualenvs/project/lib/python3.6/site-packages/flask_login/utils.py", line 258, in decorated_view
    return func(*args, **kwargs)
  File "/Users/account/Desktop/virtualenvs/project/lib/python3.6/site-packages/airflow/www/views.py", line 406, in index
    return self.render('airflow/dags.html')
  File "/Users/account/Desktop/virtualenvs/project/lib/python3.6/site-packages/airflow/www/views.py", line 396, in render
    return super(AirflowViewMixin, self).render(template, **kwargs)
  File "/Users/account/Desktop/virtualenvs/project/lib/python3.6/site-packages/flask_admin/base.py", line 308, in render
    return render_template(template, **kwargs)
  File "/Users/account/Desktop/virtualenvs/project/lib/python3.6/site-packages/flask/templating.py", line 140, in render_template
    ctx.app,
  File "/Users/account/Desktop/virtualenvs/project/lib/python3.6/site-packages/flask/templating.py", line 120, in _render
    rv = template.render(context)
  File "/Users/account/Desktop/virtualenvs/project/lib/python3.6/site-packages/jinja2/asyncsupport.py", line 76, in render
    return original_render(self, *args, **kwargs)
  File "/Users/account/Desktop/virtualenvs/project/lib/python3.6/site-packages/jinja2/environment.py", line 1008, in render
    return self.environment.handle_exception(exc_info, True)
  File "/Users/account/Desktop/virtualenvs/project/lib/python3.6/site-packages/jinja2/environment.py", line 780, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/Users/account/Desktop/virtualenvs/project/lib/python3.6/site-packages/jinja2/_compat.py", line 37, in reraise
    raise value.with_traceback(tb)
  File "/Users/account/Desktop/virtualenvs/project/lib/python3.6/site-packages/airflow/www/templates/airflow/dags.html", line 20, in top-level template code
    {% extends "airflow/master.html" %}
  File "/Users/account/Desktop/virtualenvs/project/lib/python3.6/site-packages/airflow/www/templates/airflow/master.html", line 20, in top-level template code
    {% extends "admin/master.html" %}
  File "/Users/account/Desktop/virtualenvs/project/lib/python3.6/site-packages/airflow/www/templates/admin/master.html", line 20, in top-level template code
    {% extends 'admin/base.html' %}
  File "/Users/account/Desktop/virtualenvs/project/lib/python3.6/site-packages/flask_admin/templates/bootstrap3/admin/base.html", line 95, in top-level template code
    {% block tail %}
  File "/Users/account/Desktop/virtualenvs/project/lib/python3.6/site-packages/airflow/www/templates/airflow/dags.html", line 220, in block "tail"
    const STATE_COLOR = {{ state_color|tojson }};
  File "/Users/account/Desktop/virtualenvs/project/lib/python3.6/site-packages/flask/json/__init__.py", line 376, in tojson_filter
    return Markup(htmlsafe_dumps(obj, **kwargs))
  File "/Users/account/Desktop/virtualenvs/project/lib/python3.6/site-packages/flask/json/__init__.py", line 290, in htmlsafe_dumps
    dumps(obj, **kwargs)
  File "/Users/account/Desktop/virtualenvs/project/lib/python3.6/site-packages/flask/json/__init__.py", line 211, in dumps
    rv = _json.dumps(obj, **kwargs)
  File "/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/lib/python3.6/json/__init__.py", line 238, in dumps
    **kw).encode(obj)
  File "/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/lib/python3.6/json/encoder.py", line 199, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/lib/python3.6/json/encoder.py", line 257, in iterencode
    return _iterencode(o, 0)
  File "/Users/account/Desktop/virtualenvs/capstone_project/lib/python3.6/site-packages/flask/json/__init__.py", line 100, in default
    return _json.JSONEncoder.default(self, o)
  File "/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/lib/python3.6/json/encoder.py", line 180, in default
    o.__class__.__name__)
TypeError: Object of type 'Undefined' is not JSON serializable

我已经从气流项目中删除了所有内容。我只有一个带start和end的伪运算符。这个错误是什么意思?

您提供了一个没有上下文的错误:错误发生时您在做什么?这是我的问题。我没有做任何具体的事情。。。或者如果我做了,我不知道我在做什么。我已经在一个新的虚拟环境中复制了我的项目,一切都很好…为了将来的参考,你需要提供更多的细节。这是一个很好的起点:您提供了一个没有上下文的错误:错误发生时您在做什么?这是我的问题。我没有做任何具体的事情。。。或者如果我做了,我不知道我在做什么。我已经在一个新的虚拟环境中复制了我的项目,一切都很好…为了将来的参考,你需要提供更多的细节。这是一个很好的起点: