Here is my code :
call(['youtube-dl', '-i', '--extract-audio', '--audio-format mp3','-w','ytsearch:'+song ,'-o '+song2file(song)+'.%(ext)s'], shell=False)
Note:This is an implementation of this code : youtuble-dl -i --extract-audio --audio-format mp3 -w ytsearch:Wham Bam -o WhamBam.%(ext)s
Where song = Wham Bam, When I run this cmd it works perfectly but the python implementation is not working.
On running it, it returns me this error:
youtube-dl: error: no such option: --audio-format
as part of solution, it better to format your string properly like this:
then call it
this already solve the problem you describe but it seems still have issue on the -o option. please remember to format your string properly, not carelessly.