[GH-ISSUE #155] _warn function not used correctly #74

Closed
opened 2026-02-27 23:20:42 +03:00 by kerem · 2 comments
Owner

Originally created by @fhennig on GitHub (Jan 15, 2017).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/155

The _warn function does not handle format arguments, but is used as if it would in line 849.

The function could be adapted to handle format arguments, like so:

def _warn(self, msg, *args):
    print('warning:' + msg.format(*args), file=sys.stderr)
Traceback (most recent call last):
  [...]
  File "[...]/lib/python3.4/site-packages/spotipy/client.py", line 222, in track
    trid = self._get_id('track', track_id)
  File "[...]/lib/python3.4/site-packages/spotipy/client.py", line 850, in _get_id
    type, fields[-2], id)
TypeError: _warn() takes 2 positional arguments but 5 were given
Originally created by @fhennig on GitHub (Jan 15, 2017). Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/155 The _warn function does not handle format arguments, but is used as if it would in line 849. The function could be adapted to handle format arguments, like so: def _warn(self, msg, *args): print('warning:' + msg.format(*args), file=sys.stderr) ``` Traceback (most recent call last): [...] File "[...]/lib/python3.4/site-packages/spotipy/client.py", line 222, in track trid = self._get_id('track', track_id) File "[...]/lib/python3.4/site-packages/spotipy/client.py", line 850, in _get_id type, fields[-2], id) TypeError: _warn() takes 2 positional arguments but 5 were given ```
kerem 2026-02-27 23:20:42 +03:00
  • closed this issue
  • added the
    duplicate
    label
Author
Owner

@plamere commented on GitHub (Jan 22, 2017):

thanks, will update!

<!-- gh-comment-id:274329062 --> @plamere commented on GitHub (Jan 22, 2017): thanks, will update!
Author
Owner

@stephanebruckert commented on GitHub (Jan 12, 2020):

Duplicate https://github.com/plamere/spotipy/issues/367

<!-- gh-comment-id:573425936 --> @stephanebruckert commented on GitHub (Jan 12, 2020): Duplicate https://github.com/plamere/spotipy/issues/367
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/spotipy#74
No description provided.