Mutagen File Problem

A

aiwarrior

Hi i'm having a IO error saying a file does not exist even though i
perform a isFile() check. Can you help me out figuring what is wrong?

Thanks in advance

from mutagen.easyid3 import EasyID3
from mutagen.mp3 import MP3

for root, dirs, files in os.walk('''C:\\Documents and Settings\\pneves\
\Music\\''', topdown=False):
for name in files:
joined = os.path.join(root, name)
if (name[-3:] == 'mp3' ):
audio = MP3(joined, ID3=EasyID3)
if not audio.has_key('album') and
os.path.isfile(joined):
print os.path.join(root, name)

I get an error as following:

IOError: [Errno 2] No such file or directory: 'C:\\Documents and
Settings\\pneves\\Music\\Naked Music - Miguel Migs - Colorful You\
\Miguel Migs - Colorful you - Full album\\Miguel Migs - Colorful you -
Cd 2 -Mixed and mastered by J. Mark Andrus\\7 - Miguel Migs feat. Lisa
Shaw - You Bring Me Up (Main Vocal Mix).mp3'
 
M

Max Erickson

aiwarrior said:
Hi i'm having a IO error saying a file does not exist even though
i perform a isFile() check. Can you help me out figuring what is
wrong?

Thanks in advance

from mutagen.easyid3 import EasyID3
from mutagen.mp3 import MP3

for root, dirs, files in os.walk('''C:\\Documents and
Settings\\pneves\ \Music\\''', topdown=False):
for name in files:
joined = os.path.join(root, name)
if (name[-3:] == 'mp3' ):
audio = MP3(joined, ID3=EasyID3)
if not audio.has_key('album') and
os.path.isfile(joined):
print os.path.join(root, name)

I get an error as following:

IOError: [Errno 2] No such file or directory: 'C:\\Documents and
Settings\\pneves\\Music\\Naked Music - Miguel Migs - Colorful
You\ \Miguel Migs - Colorful you - Full album\\Miguel Migs -
Colorful you - Cd 2 -Mixed and mastered by J. Mark Andrus\\7 -
Miguel Migs feat. Lisa Shaw - You Bring Me Up (Main Vocal
Mix).mp3'

It looks like the error is happending in MP3(join...), so the
os.path.isfile check is never reached. If that is the case,
something along the lines of:

try:
audio=MP3(joined, ID3=EasyID3)
except: #catches any error in MP3...
print joined

should suppress the error and print the filename that triggered it.


max
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,119
Latest member
IrmaNorcro
Top