views:

27

answers:

1

Ive just started using mutagen and have succefully used it with m4a, mp3, ape, afs, and flac. However Im having difficulty with the OggFileType class, when I try to create an instance of OggFileType Im presented with a "TypeError: 'NoneType' object is not callable" exception.

Iv searched and searched for solutions but information and documentation on mutagen is scarce. Any help would be appreciated thanks.

A snippet of the code I am using for testing

path = "I:\Music\Various Artists\Studio One Classics"
audiofile = "16 - Rub A Dub Style.ogg"
os.chdir(path)
OggTag = OggFileType(audiofile)
print OggTag

Traceback

Traceback (most recent call last):
  File "I:\My Documents\Programming\python\music_organizer\mutagen_test.py", line 203, in <module>
    OggTag = OggFileType(audiofile)
  File "C:\Python26\lib\site-packages\mutagen\__init__.py", line 75, in __init__
    self.load(filename, *args, **kwargs)
  File "C:\Python26\lib\site-packages\mutagen\ogg.py", line 441, in load
    self.info = self._Info(fileobj)
TypeError: 'NoneType' object is not callable
+1  A: 

You're not supposed to use OggFileType directly. It's a base class for the other Ogg format classes -- OggVorbis, OggTheora, etc. Those all properly set _Info, _Tags, _Error appropriately. This is noted in the documentation for the ogg.py module:

Read and write Ogg bitstreams and pages.

This module reads and writes a subset of the Ogg bitstream format version 0. It does not read or write Ogg Vorbis files! For that, you should use mutagen.oggvorbis.

jamessan
I was sure I had already read that doc string -obviously not. Thanks
volting