[ovirt-devel] logging.captureWarnings only in Python 2.7, EL6 broken

Nir Soffer nsoffer at redhat.com
Tue Oct 21 19:13:35 UTC 2014


----- Original Message -----
> From: "Ondřej Svoboda" <osvoboda at redhat.com>
> To: devel at ovirt.org
> Sent: Tuesday, October 21, 2014 8:07:09 PM
> Subject: [ovirt-devel]  logging.captureWarnings only in Python 2.7, EL6 broken
> 
> Hi all,
> 
> Sandro pointed out that tests are failing on
> 
> File "../tests/testrunner.py", line 33, in <module>
> logging.captureWarnings(True)
> AttributeError: 'module' object has no attribute 'captureWarnings'
> 
> The code, conditionally using the function also in our daemon, has been
> introduced on http://gerrit.ovirt.org/#/c/34034, adding support for
> 'warnings' module.
> 
> I have dug in Python changelogs and found that captureWarnings has, sadly,
> never been backported to Python 2.6. I have seen another project [1] employ
> the function only optionally. But for us, this probably makes the support
> for 'warnings' module in logging also optional in effect.
> 
> Saggi, I wanted to notice you about this. Do you think 'warnings' could be
> made to work in a different way, or are they only possible on platforms
> having Python 2.7+?

Warnings is for developers, not having them in the logs in 2.6 is not a big
deal.

Lets use captureWarnings only if the attribute exists.

Nir



More information about the Devel mailing list