Unable to add metadata to mp3 (AttributeError: 'NoneType' object has no attribute 'initTag')

210 Views Asked by At

I am trying to use the eyed3 library to add metadata to an mp3 file I've downloaded using the youtube-dl library. Here's my code:

def updateMetadata(metadata, thumbnail, song):
    file = "/PATH/TO/DIRECTORY/" + song
    musicfile = eyed3.load(file)
    musicfile = musicfile.initTag() #where error occurs
    musicfile.artist = metadata[1]
    musicfile.tag.save(file)

However I get the error: AttributeError: 'NoneType' object has no attribute 'initTag.' The PATH is correct and leads to the file which is an mp3. I'm aware there's another question with this problem but neither of the solutions worked and the question is old so I'm asking a new one.

0

There are 0 best solutions below