rckclmbr / pyportify

App to transfer your spotify playlists to Google Play Music
Apache License 2.0
779 stars 58 forks source link

missing 1 required positional argument: 'track' #135

Closed Jmez closed 6 years ago

Jmez commented 6 years ago

When transferring any playlists via web interface or pyportify-copyall script it fails to transfer any files.

Both Spotify and Google Play Music accounts are premium subscriptions. OS: Ubuntu 16.04.4 Python3 version: 3.5.2

Scopes granted for Spotify Access Token: playlist-read-private playlist-read-collaborative user-library-read

Request URL: http://localhost:3132/portify/transfer/start Request Method: POST Status Code: 500 Internal Server Error Remote Address: 127.0.0.1:3132 Referrer Policy: no-referrer-when-downgrade

Gathering tracks for playlist Primavera Sound 2018 (596)
Error handling request
Traceback (most recent call last):
  File "/home/jamesr/.local/lib/python3.5/site-packages/aiohttp/web_protocol.py", line 416, in start
    resp = yield from self._request_handler(request)
  File "/home/jamesr/.local/lib/python3.5/site-packages/aiohttp/web.py", line 325, in _handle
    resp = yield from handler(request)
  File "/home/jamesr/.local/lib/python3.5/site-packages/aiohttp/web_middlewares.py", line 93, in impl
    return (yield from handler(request))
  File "/usr/local/lib/python3.5/dist-packages/pyportify-0.4.1-py3.5.egg/pyportify/middlewares.py", line 14, in index_handler
    ret = await handler(request)
  File "/usr/local/lib/python3.5/dist-packages/pyportify-0.4.1-py3.5.egg/pyportify/app.py", line 104, in transfer_start
    await transfer_playlists(request, s, g, lists)
  File "/usr/local/lib/python3.5/dist-packages/pyportify-0.4.1-py3.5.egg/pyportify/app.py", line 144, in transfer_playlists
    query = SpotifyQuery(i, sp_playlist_uri, sp_track, track_count)
  File "/usr/local/lib/python3.5/dist-packages/pyportify-0.4.1-py3.5.egg/pyportify/spotify.py", line 9, in __init__
    self.track = Track.from_spotify(sp_track.get("track", {}))
TypeError: from_spotify() missing 1 required positional argument: 'track'
Jmez commented 6 years ago

Additional: Just tried on my laptop with the same result. OS: Arch Python3 Version: 3.6.4 Pyportify version: 0.4.1

scottpaine commented 6 years ago

Upon looking into this, I discovered the problem:

In serializers.py, the Track.from_spotify method is listed as a staticmethod, but has two arguments (self and track).

The solution is either to remove self from the arguments or make Track.from_spotify a classmethod. I'll submit a pull request that addresses this shortly.