0

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?

2
  • I installed azlyrics via pip. It is in Python/3.7/Lib/site-packages Commented Mar 28, 2020 at 7:12
  • In the module named 'azlyrics' the function 'artists' is well defined. Commented Mar 28, 2020 at 7:14

1 Answer 1

3

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.

Sign up to request clarification or add additional context in comments.

4 Comments

Thank you. Could you please elaborate the problem sot it can be fixed.
@ASWINVENU, are you the author of this lib? No sure I have time for that…
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.
@ASWINVENU, see this commit: github.com/adhorrig/azlyrics/commit/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.