簡體   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