Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix NoneType attribute error in np.py #20

Merged
merged 2 commits into from May 2, 2024

Conversation

albertsj1
Copy link
Contributor

This fixes the following error in np.py if no track is currently playing.

./np.py
Traceback (most recent call last):
  File "np.py", line 113, in <module>
    main()
  File "np.py", line 83, in main
    output(is_track_loved(now_playing))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "np.py", line 45, in is_track_loved
    text = f"{track.artist} - {colored(track.title, attrs=['bold'])}"
              ^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'artist'

Instead, No track currently playing is displayed.

np.py Outdated Show resolved Hide resolved
@hugovk hugovk merged commit d43697f into hugovk:main May 2, 2024
2 checks passed
@hugovk
Copy link
Owner

hugovk commented May 2, 2024

Thank you!

@albertsj1 albertsj1 deleted the fix_np_track_error branch May 3, 2024 02:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants