Frage

I have been using the mutagen package (version - mutagen-1.20) for Python 2.7 on my Windows 7 machine for sometime now, unfortunately it stopped working earlier today.

I have re-installed the package, deleted all files that belong to this package and again re-installed it all over, but all efforts were in vain. What confuses me is that all this was working well till yesterday. Can someone point to me what might be wrong. I have mentioned below some code and logs for reference. Thanks!

I also have eyed3 package installed and this is working well for the same mp3 file being used here. Unfortunately eyed3 isnt as impressive as mutagen and I am stuck in this strange situation.

mutagen.py - Python code used for testing (example.mp3 is in the same directory where the script is):

from mutagen.mp3 import MP3
audio = MP3("example.mp3")
print audio.info.length, audio.info.bitrate

Error Log from command prompt:

C:\Python27>python mutagen.py
Traceback (most recent call last):
  File "mutagen.py", line 1, in <module>
    from mutagen.mp3 import MP3
  File "C:\Python27\mutagen.py", line 1, in <module>
    from mutagen.mp3 import MP3
ImportError: No module named mp3
War es hilfreich?

Lösung

Name your python file something else. Because it's named mutagen.py your import statement is getting the wrong module. Try mutagen_test.py.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top