AttributError:'NoneType'对象没有属性'exc_info'

时间:2017-06-24 11:39:47

标签: django

当我在staging上运行时,我在Django项目中遇到以下错误,但我的本地计算机上没有出现错误:

Unhandled exception in thread started by <function wrapper at 0x7f28cb57e500>
Traceback (most recent call last):
  File "/root/.virtualenvs/thakurani/local/lib/python2.7/site-packages/django/utils/autoreload.py", line 228, in wrapper
    _exception = sys.exc_info()
AttributeError: 'NoneType' object has no attribute 'exc_info'

1 个答案:

答案 0 :(得分:0)

这没什么好担心的,虽然有点令人困惑。如果修改了任何python文件,则会重新加载重新加载功能。如果在重载正在运行时点击ctrl-c,则sys模块已被卸载,并且在触发异常时变量未定义。

实际上,它可能会在KeyboardInterrupt上触发,因为它会捕获所有异常。如果您能够在100%的时间内触发此操作,则有点奇怪 - 这意味着您的文件会不断被修改或以其他方式触发自动重载。

由于不可能在那里获得真实的痕迹而且它有线程,因此很难找到问题的根源。