Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python's logging module misses "captureWarnings" function

Python's standard logging module is supposed to contain a useful captureWarnings function that allows integration between the logging and the warnings modules. However, it seems that my installation misses this function:

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

What am I doing wrong?

like image 494
Boris Gorelik Avatar asked Feb 22 '23 19:02

Boris Gorelik


1 Answers

Unfortunately, there is no such method in Python 2.6.5's logging module. You need Python 2.7.

like image 53
Petr Viktorin Avatar answered Feb 25 '23 14:02

Petr Viktorin