I am writing a small python script, where I also want to execute some bash commands by using os.opopen(). I want to save the output to file but it is not working. I have used the ">" before and it always works.
My code:
curl https://r2---sn-4g5e6ne6.googlevideo.com/videoplayback?key=yt6&txp=5432432&mime=video%2Fwebm&pl=16&source=youtube&gir=yes&signature=6A07D1659991EC9A570BC6A0E9C10FB54E743DBC.DA7798D03282620987FC2FBDB020D3FE464851F3&fvip=2&requiressl=yes&sparams=aitags%2Cclen%2Cdur%2Cei%2Cgir%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Ckeepalive%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpl%2Crequiressl%2Csource%2Cexpire&ei=sTFcXPqmN9PlgAeN6ZiYCQ&itag=247&ipbits=0&mm=31%2C26&mn=sn-4g5e6ne6%2Csn-i5heen7l&c=WEB&id=o-AHSObPeCuNcs7m1xagNdnC7zcHOvQEKkCrV9NDTw7g7a&initcwndbps=1722500&ip=132.187.12.151&clen=64580535&mt=1549545753&mv=m&dur=561.594&ms=au%2Conr&keepalive=yes&expire=1549567506&aitags=133%2C134%2C135%2C136%2C137%2C160%2C242%2C243%2C244%2C247%2C248%2C278&lmt=1541003190670111&ratebypass=yes > test.bin
The bash command on its own works as expected.
Python command that I use:
os.popen("curl "+url+" > "test.bin") #url predefined
Any ideas where the problem could be?