Help with Python/Eyed3 MusicCDIdFrame method

MRAB python at mrabarnett.plus.com
Mon Jun 6 12:46:09 EDT 2022


On 2022-06-06 11:37, Dave wrote:
> Hi,
> 
> I’m trying to get the ID3 tags of an mp3 file. I trying to use the MusicCDIdFrame
>   method but I can’t seem to get it right. Here is a code snippet:
> 
> 
>   import eyed3
> import eyed3.id3
> import eyed3.id3.frames
> import eyed3.id3.apple
> import eyed3.mp3
> myID3 = eyed3.load("/Users/Test/Life in the fast lane.mp3")
> myTitle = myID3.tag.title
> myArtist = myID3.tag.artist
> myAlbum = myID3.tag.album
> myAlbumArtist = myID3.tag.album_artist
> myComposer = myID3.tag.composer
> myPublisher = myID3.tag.publisher
> myGenre = myID3.tag.genre.name
> myCDID = myID3.id3.frames.MusicCDIdFrame(id=b'MCDI', toc=b'')
> 
> When I run this, I get the following error:
> 
>    File "/Documents/Python/Test1/main.py", line 94, in <module>
>      myCDID = myID3.id3.frames.MusicCDIdFrame(id=b'MCDI', toc=b'')
> AttributeError: 'Mp3AudioFile' object has no attribute 'id3'
> 
> 
> Any help or suggestion greatly appreciated.
> 
That line should be:

myCDID = eyed3.id3.frames.MusicCDIdFrame(id=b'MCDI', toc=b'')

Also remember that some attributes might be None, e.g. 'myID3.tag.genre' 
might be None.

Another point: it's probably not worth importing the submodules of 
'eyed3'; you're not gaining anything from it.


More information about the Python-list mailing list