我在django应用程序的视图中遇到了这个异常。但我认为我的问题根本与姜戈无关。这是一个蟒蛇的东西:
Traceback:
File "/home/ubuntu/app/.venv/lib/python3.5/site-packages/django/core/handlers/exception.py" in inner
35. response = get_response(request)
File "/home/ubuntu/app/.venv/lib/python3.5/site-packages/django/core/handlers/base.py" in _get_response
128. response = self.process_exception_by_middleware(e, request)
File "/home/ubuntu/app/.venv/lib/python3.5/site-packages/django/core/handlers/base.py" in _get_response
126. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/ubuntu/app/frontend/views.py" in ajax_patient_pm
2977. (gstatus, gmessage) = grecaptcha_verify(request)
Exception Type: TypeError at /de/ajax/contactpatientpm/
Exception Value: 'NoneType' object is not iterable
Request information:
USER: AnonymousUser
GET: No GET data
POST: No POST data
FILES: No FILES data
COOKIES: No cookie data
这个追踪令我困惑。没有循环。我看不出None
在任何变量中的位置会有什么影响。
有人能解释一下吗?
'NoneType' object is not iterable
通常在尝试迭代None
时遇到,但也可能在尝试对None
执行序列拆包时遇到,如下所示:
>>> x, y = None
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'NoneType' object is not iterable