Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #16
In Python 3, calling logger.warn/error/whatever() functions automatically triggers logging configuration when it's not been set up. In Python 2, not configuring logging causes a spurious
No handlers could be found for logger "jebenaclient"to be emitted.This PR only calls basicConfig() when in python2 -- from what I recall, calling basicConfig() in a package that one imports can cause some side-effects if the main program hasn't already triggered its logging config. (Essentially: the first call to configure logging is the one that wins; or at least by default. I would need to research to confirm if this is strictly true, but ... I've seen enough issues with this pattern to want to avoid it.)
Simple way to reproduce the issue:
test.py, put:foo.py, put:Running
python3 test.pywill result in just the print() statement; running python2 will cause the logger-not-configured error. (Note I'm testing on MacOS, where future imports automatically supportprint()notation in Python 2.)