If you are using os rename src dest…

1 minute read Modified:

If you are using os.rename(src,dest) outside the current working directory, you can’t simply use os.rename(filename, “output.mp3”) since it will move the file to the current working directory. You should rather, path.dirname to get the file’s directory and then rename the file. For example you can use `os.rename(file_name, os.path.dirname(file_name) + ‘/{song_title}.mp3’.format(song_title=song_title))`