I'm using this code.
from azlyrics import artists
print(artists("O"))
In the module named 'azlyrics' the function 'artists' is well defined. But I get this error.
Traceback (most recent call last):
File "C:\Users\user\Desktop\python\eminem\New folder\azlyrics-master\examples\get_artists.py", line 1, in <module>
from azlyrics import artists
ImportError: cannot import name 'artists' from 'azlyrics' (C:\Users\user\AppData\Local\Programs\Python\Python37\lib\site-packages\azlyrics\__init__.py)
What could be the problem?
-
I installed azlyrics via pip. It is in Python/3.7/Lib/site-packagesUser– User2020年03月28日 07:12:50 +00:00Commented Mar 28, 2020 at 7:12
-
In the module named 'azlyrics' the function 'artists' is well defined.User– User2020年03月28日 07:14:22 +00:00Commented Mar 28, 2020 at 7:14
1 Answer 1
There must be a bug in the azlyrics documentation or packaging.
This works:
>>> from azlyrics.azlyrics import artists
>>> artists("O")
'["Oakenfold, Paul", "Oakes, Ryan", "Oak Ridge Boys,
The", "Oak, Winona", "O.A.R. (Of A Revolution)", "Oasis", "Obel, Agnes", "Oberst, ...]'
There is a mistake in azlyrics v1.3.2, relative import should be used in azlyrics/__init__.py:
instead of:
from azlyrics import *
we should have:
from .azlyrics import *
This is fixed but a release is not done.
answered Mar 28, 2020 at 7:16
Laurent LAPORTE
23.2k7 gold badges64 silver badges111 bronze badges
Sign up to request clarification or add additional context in comments.
4 Comments
User
Thank you. Could you please elaborate the problem sot it can be fixed.
Laurent LAPORTE
@ASWINVENU, are you the author of this lib? No sure I have time for that...
User
No I'm not. But if you can't spare time you could just give me the keyword related to the bug so I can search the web.
Laurent LAPORTE
@ASWINVENU, see this commit: github.com/adhorrig/azlyrics/commit/…
lang-py