Chanon Deeprasertkul Chanon Deeprasertkul - 1 year ago 186
Python Question

How to get detail (Title,Artist) from .mp3 files in python using eyed3

Here is my code

import eyed3

audiofile = eyed3.load("19 Calvin Harris - Summer.mp3")


This is an error

Traceback (most recent call last):
File "C:\Python34\", line 5, in <module>
AttributeError: 'NoneType' object has no attribute 'artist'

There's attributes shown in Visual Studio. but when i run error occurred

when i write
it works. i don't know why
ps. Python 3.4.

Answer Source

Title and Artists are available through accessor functions of the Tag() return value. The example below shows how to get them using getArtist() and getTitle() methods.

 import eyed3
 tag = eyed3.Tag()"/some/file.mp3")
 print tag.getArtist()
 print tag.getTitle()
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download