文章詳情頁
python 利用subprocess庫調用mplayer時發生錯誤
瀏覽:84日期: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. html5 - ElementUI table中el-table-column怎么設置百分比顯示。2. python - 使用readlines()方法讀取文件內容后,再用for循環遍歷文件與變量匹配時出現疑難?3. 對mysql某個字段監控的功能4. css3 - less或者scss 顏色計算的知識應該怎么學?或者在哪里學?5. 注冊賬戶文字不能左右分離6. javascript - table列過多,有什么插件可以提供列排序和選擇顯示列的功能7. css - 網頁div區塊 像蘋果一樣可左右滑動 手機與電腦8. javascript - 數組的過濾和渲染9. html - vue項目中用到了elementUI問題10. JavaScript事件
排行榜
