Sponsored By

Sign in to follow this  
shanenin

"/" Causing Problems With Python Function

Recommended Posts

I have been working on a script that rips music cds and encodes, and renames files using the CDDB database. I noticed the script failed when a "/" is in the name of the file I want to change the name to. Example:

>>> os.rename('track04.cdda.wav.mp3','The Rolling Stones / Intro Excerpt From Fanfare For The Common Man.mp3')
Traceback (most recent call last):
 File "<stdin>", line 1, in ?
OSError: [Errno 2] No such file or directory

if I remove the "/" the above code works just fine, so I am pretty certain the "/" is causing the problem

but I am able to use that symbol with string functions

>>> 'The Rolling Stones / Intro Excerpt From Fanfare For The Common Man.mp3 '.lower()
'the rolling stones / intro excerpt from fanfare for the common man.mp3 '

why is it failing with the os.rename() finction

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this