0

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.

kraken1989
  • 23
  • 4
  • 1
    Welcome to Stack Overflow. Does the file exist? Is the path correct? Judging from the error, I'd hazard a guess that ```muscifile``` is ```None``` meaning that it probably couldn't load the file for some reason. – ewokx Aug 01 '22 at 01:21
  • It both exists and is correct. – kraken1989 Aug 01 '22 at 01:38

0 Answers0