简体   繁体   English

Windows Python 2.5 Traceback.py Nonetype错误

[英]Windows Python 2.5 Traceback.py Nonetype error

Hello I am running Python 2.5 on Windows and whenever my application gets an exception rather than seeing the debug information I get an error inside of the traceback.py file itself. 您好我在Windows上运行Python 2.5,每当我的应用程序获得异常而不是看到调试信息时,我在traceback.py文件本身内部都会收到错误。 Anyone know a fix for this mb a patch or replacement file. 任何人都知道这个补丁或替换文件的修复程序。

Traceback (most recent call last):
  File "C:\Python25\lib\logging\__init__.py", line 744, in emit
    msg = self.format(record)
  File "C:\Python25\lib\logging\__init__.py", line 630, in format
    return fmt.format(record)
  File "C:\Python25\lib\logging\__init__.py", line 426, in format
    record.exc_text = self.formatException(record.exc_info)
  File "C:\Python25\lib\logging\__init__.py", line 398, in formatException
    traceback.print_exception(ei[0], ei[1], ei[2], None, sio)
  File "C:\Python25\lib\traceback.py", line 126, in print_exception
    lines = format_exception_only(etype, value)
  File "C:\Python25\lib\traceback.py", line 176, in format_exception_only
    stype = etype.__name__
AttributeError: 'NoneType' object has no attribute '__name__'

===EDIT=== ===编辑===

Found same error in mailing list here outdated answer it seems 在邮件列表中发现相同的错误这里似乎过时了

http://mail.python.org/pipermail/python-dev/2006-September/068975.html http://mail.python.org/pipermail/python-dev/2006-September/068975.html

Possible causes: 可能的原因:

  1. Calling logging.exception() when there is no active exception 没有活动异常时调用logging.exception()
  2. Calling a logging function with exc_info=1 , when there is no active exception. 当没有活动异常时,使用exc_info=1调用日志记录函数。
  3. Calling a logging function with exc_info=(None, None, None) to a logging function (eg if doing the exception logging manually). 使用exc_info=(None, None, None)调用日志记录函数到日志记录功能(例如,如果手动执行异常日志记录)。

You should not use logging.exception outside of an except block. 您不应该在except块之外使用logging.exception

The exception is caused by a None exception type passed to traceback.print_exception , meaning that there is no active exception to process. 异常是由传递给traceback.print_exceptionNone异常类型引起的,这意味着没有要处理的活动异常。

Meanwhile, the newsgroup posting you linked to indicates that it was a regression in the standard library that resulted in that particular traceback. 同时,您链接到的新闻组发布表明它是标准库中的回归导致该特定回溯。 You may want to try upgrading your Python to 2.5.1, which fixed this particular problem. 您可能想尝试将Python升级到2.5.1,这解决了这个特殊问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM