Unable to save ID3 info if song tag property is None

Issue #34 invalid
Former user created an issue

I want to update the ID3 metadata of a song which currently don't have any information about song.

But when I tried doing so it gave me an error: AttributeError: 'NoneType' object has no attribute 'title' in code:

import eyed3 as ed
mf = ed.load('a.mp3')
mf.tag.title = 'ABC'

According to this error we won't be able to change metadata of any song if it don't have any value assigned previously.

Comments (8)

  1. Aki92

    I had created this issue and I saw somewhere that same issue was reported previously also and it was fixed at that time, but still it causing problem.

  2. Travis Shirk repo owner

    Where did you see this was fixed? Since there is nothing to fix, really. It could be easier, I suppose, but this works and is how it is done.

    import eyed3
    import eyed3.id3
    f = eyed3.load("foo.id3")
    if f.tag is None:
        f.tag = eyed3.id3.Tag()
        f.tag.file_info = eyed3.id3.FileInfo("foo.id3")
    f.tag.title = u"title"
  3. Aki92

    Actually Sir I saw this somewhere in a blog where the person was working with 0.6 version. But anyways the code which you had written above works for me, thanks a lot sir and yes sir u'ABC' is correct.

    Sir I am working with eyeD3 from last 1 week and I found this library very useful and easy to use but sir I think its documentation lacks a lot, because for everything I had to use the help command as I don't find things in documentation.

    And sir I also wanted to ask that does eyeD3 works in Windows also ?

  4. Log in to comment