mental32 / spotify.py

🌐 API wrapper for Spotify 🎶
https://spotifypy.readthedocs.io/en/latest/
MIT License
150 stars 38 forks source link

Cannot import #2

Closed l0ner closed 5 years ago

l0ner commented 5 years ago

Hi!

So, I'm trying to use this library, byt apparentely I cannot use it in python3.5 as i cannot import it. The error is:

Python 3.5.3 (default, Sep 27 2018, 17:25:39)
[GCC 6.3.0 20170516] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import asyncio
>>> import spotify
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.5/dist-packages/spotify/__init__.py", line 7, in <module>
    from .models import *
  File "/usr/local/lib/python3.5/dist-packages/spotify/models/__init__.py", line 7, in <module>
    from .playlist import Playlist
  File "/usr/local/lib/python3.5/dist-packages/spotify/models/playlist.py", line 29
    yield PlaylistTrack(self.__client, track)
    ^
SyntaxError: 'yield' inside async function

Any way to bypass this?

mental32 commented 5 years ago

Ah this is my fault, When I added the new playlist track async iterator I forgot to change the python requires on setup.py.

The library is now 3.6+ anything less isn't supported. Although I may make the whole library 2to3 compatible in the future right now this isn't in the works.

Simply put the fix for that is use Python 3.6+ not 3.5 @l0ner

l0ner commented 5 years ago

ok, reasonable

But what if my distro doesn't provide python3.6 (debian-stable and raspbian provides only 2.7 and 3.5). I'm not keen on installing python on debian from source or external repos. Could be there a workaround to make it work with 3.5?

mental32 commented 5 years ago

I have revised some of the code in the playlist.py, this should remove the 3.6 dependency. Install the new version (0.2.0) and try it out If there are any issues let me know

l0ner commented 5 years ago

Now it works!

Thanks for the quick fix.