Skip to content
Advertisement

python export() got multiple values for argument ‘format’

i have a wav file and i want to split according to the data i have in a list called speech and to export the the splitted wav files in folders according to the label variable

  label=speech[0]
  start= speech[1]
  end = speech[2] 
  newAudio = AudioSegment.from_wav(audio_file_path)
  newAudio = newAudio[start:end]
  if label==1:
    newAudio.export('/content/',x,'.wav', format="wav")
  else:
    newAudio.export('/content/',x,'.wav', format="wav")

but i keep getting the error export() got multiple values for argument ‘format’

Advertisement

Answer

The function definition of export is as follows:

export(self, out_f=None, format='mp3', codec=None, bitrate=None, parameters=None, tags=None, id3v2_version='4', cover=None)

I think what you’re trying to do with your first parameter is a string concatenation, e.g. change it to a f-string:

newAudio.export(f'/content/{x}.wav', format='wav')
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement