繁体   English   中英

Python的日志记录模块错过了“captureWarnings”功能

[英]Python's logging module misses “captureWarnings” function

Python的标准日志记录模块应该包含一个有用的captureWarnings函数 ,它允许日志记录和警告模块之间的集成。 但是,似乎我的安装错过了这个功能:

Python 2.6.5 (r265:79096, Mar 19 2010, 21:48:26) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import logging
>>> logging.captureWarnings
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'captureWarnings'
>>> import logging.captureWarnings
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named captureWarnings
>>> import warnings
>>> import logging.captureWarnings
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named captureWarnings
>>>

我究竟做错了什么?

不幸的是, Python 2.6.5的日志记录模块中没有这样的方法。 你需要Python 2.7。

暂无
暂无

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

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