文章详情页
python 利用subprocess库调用mplayer时发生错误
浏览:268日期:2022-09-13 17:22:57
问题描述
脚本在读取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_posn’)print p.stdout.read()
问题解答
回答1:mplayer播放时会向stout输入大量字符,超过了4096造成死锁,输出信息不在我的需求之中,因此决定修改stdout=open('/dev/null','w'),解决问题。参考博客http://blog.csdn.net/imzoer/a...
上一条:python - django在nginx里模板输出html标签问题下一条:python - pandas dataframe如何对某列的空数据位置进行update?update的函数是自定义的,参数是同一行的另外两列数据
相关文章:
1. 关docker hub上有些镜像的tag被标记““This image has vulnerabilities””2. angular.js - angular中的a标签不起作用3. javascript - 微信公号里采用七牛上传视频部分手机不能选择文件4. docker - 各位电脑上有多少个容器啊?容器一多,自己都搞混了,咋办呢?5. docker 17.03 怎么配置 registry mirror ?6. MySQL 如何从 datetime 类型的字段选择 date7. javascript - 获取标签中的字符串8. python - 怎样在linux下开发flask web应用时查看代码出错(traceback)的地方。9. sublime-text - sublime text 3中编译python(sublimeREPL),如何仅运行单行/选定部分10. angular.js使用$resource服务把数据存入mongodb的问题。
排行榜

网公网安备