2

Script :

from pydub import AudioSegment
sound = AudioSegment.from_mp3("/srv/python/welcome.mp3")
sound.export("/srv/python/test", format="wav")

ERROR:

IsADirectoryError: [Errno 21] Is a directory: '/srv/python/test'

path /srv/python/test is exits with write permission (777) and /srv/python/welcome.mp3 is also exits

Saurabh Chandra Patel
  • 12,712
  • 6
  • 88
  • 78

2 Answers2

4

As per the pydub docstring for the method you're using (my emphasis):

Export an AudioSegment to a file with given options

out_f (string): Path to destination audio file

the parameter is supposed to be a file.

You appear to have provided a directory as the argument, so you may want to change it to something like:

sound.export("/srv/python/test/actual_file_name.wav", format="wav")
Community
  • 1
  • 1
paxdiablo
  • 854,327
  • 234
  • 1,573
  • 1,953
0

I Was wrong in

sound.export("/srv/python/test", format="wav")

line, first param should be file instead of folder location

sound.export("/srv/python/test/welcome.wav", format="wav")
Saurabh Chandra Patel
  • 12,712
  • 6
  • 88
  • 78