Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable captureWarning only in supported Python version #840

Closed
wants to merge 1 commit into from

Conversation

pythianjoseph
Copy link

With older Python versions, Diamond breaks with following error.

    logging.captureWarnings(True)
AttributeError: 'module' object has no attribute 'captureWarnings'

Following commit caused the regression.

commit a2bde9d38bca99e5d71371ac22ea74ea6cae7d83
Author: Mathieu Lecarme <mlecarme@bearstech.com>
Date:   Thu Oct 16 11:44:49 2014 +0200

    Some modules use the warnings API.

diff --git a/src/diamond/collector.py b/src/diamond/collector.py
index 9bf5593..2f76b46 100644
--- a/src/diamond/collector.py
+++ b/src/diamond/collector.py
@@ -165,6 +165,7 @@ class Collector(object):
         Create a new instance of the Collector class
         """
         # Initialize Logger
+        logging.captureWarnings(True)
         self.log = logging.getLogger('diamond')
         # Initialize Members
         self.name = self.__class__.__name__

@kormoc
Copy link
Contributor

kormoc commented Mar 17, 2017

This repo has moved to https://github.com/python-diamond/Diamond

Please open a new pull request there if this issue is not resolved with the current code there.

Thanks!

@kormoc kormoc closed this Mar 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants