python 利用subprocess库调用mplayer时发生错误
伊谢尔伦
伊谢尔伦 2017-04-18 10:21:43
0
1
606

脚本在读取stdout时卡住,不再继续执行,也不发生终止

import subprocess
 
p = subprocess.Popen(["mplayer", "-slave", "-quiet", "/home/pi/Music/爱的翅膀.mp3"], stdin = subprocess.PIPE, stdout = subprocess.PIPE, stderr = subprocess.PIPE, shell = False)
 
p.stdin.write('\n') 
print p.stdout.read() //此处
p.stdin.write('get_time_pos\n')
print p.stdout.read()
伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

reply all(1)
Ty80

When mplayer plays, a large number of characters will be input to stout. If the number exceeds 4096, it will cause a deadlock. The output information is not what I want, so I decided to modify it stdout=open("/dev/null","w") to solve the problem. Reference blog http://blog.csdn.net/imzoer/a...

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template