1

so i have file text contains with binary number 1 and 0. i want to make the text file to mp3 file and i found pydub. but i got error:

[Errno 22] Invalid argument: 'F:\KULIAH\SEMESTER8\SKRIPSI\MusicLockApp\txt\done.txt'

i just trying to open my file and try the pydub. can someone fix my code?

def readbinaryfinal():
    audio = "F:\KULIAH\SEMESTER8\SKRIPSI\MusicLockApp\txt\done.txt"

    sound = AudioSegment.from_file(audio, "txt")
    sound.export("media/em/", format="mp3", bitrate="128l")

1 Answers1

0

Looks like those slashes need escaping... 'F:\\KULIAH\\SEMESTER8\\SKRIPSI\\MusicLockApp\\txt\\done.txt'

(Or change them to forward slashes, / if python in windows copes with that?)

Noscere
  • 417
  • 3
  • 8