mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-04-27 00:25:54 +03:00
[GH-ISSUE #478] Importing spotipy breaks logs even on simple code #282
Labels
No labels
api-bug
bug
dependencies
documentation
duplicate
enhancement
external-ide
headless-mode
implicit-grant-flow
invalid
missing-endpoint
pr-welcome
private-api
pull-request
question
spotipy3
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/spotipy#282
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @zambam5 on GitHub (Apr 24, 2020).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/478
After moving machines and updating things, I noticed that when I use Spotipy it breaks any sort of logging that I've been doing. This is basic example where if I don't import Spotipy, everything works as expected, but if I do it does not log. This is in Python 3.8.2
@ritiek commented on GitHub (Apr 24, 2020):
It seems the regression was caused in
c6de8dc713. I'm not sure why this change would break logging.@ritiek commented on GitHub (Apr 24, 2020):
It looks like external scripts are unable to override this logging configuration which has once been set in spotipy.
@stephanebruckert commented on GitHub (Apr 26, 2020):
I will have a look this week. I initially added
github.com/plamere/spotipy@c6de8dc713because tests were failing. Perhaps I should just have addedlogging.basicConfig()in the tests rather than in the code? The thing is that it should also work for anyone without specifyinglogging.basicConfig()in their code@Beahmer89 commented on GitHub (Apr 26, 2020):
I was just about to file a bug about this, but generally libraries should not initialize the logging system. That should be left to the underlying application that is using the library. Libraries like requests and psycopg2 follow this pattern.
As far as tests failing, the tests seemed to have been passing when I submitted the work for my PR to add the logging here. So if they were breaking it might have been something else that was added with later changes. But I just pulled down the latest code down and the tests seem to pass. Should be safe to remove.
@stephanebruckert commented on GitHub (Apr 26, 2020):
Alright I found that this error only happens with python2
but it's all good with python3
So let's not worry about it unless someone complains about it. I'm going to merge your PR now @Beahmer89, thanks for that! also thanks for reporting @zambam5
@stephanebruckert commented on GitHub (Apr 26, 2020):
Released in 2.12.0, @zambam5 feel free to upgrade
@Beahmer89 commented on GitHub (Apr 26, 2020):
huh, thats crazy that that only happens in python2. Interesting find @stephanebruckert! I was only running my tests in python3, but will have to mess around with a python2.7 env.