文章詳情頁
python 利用subprocess庫調用mplayer時發生錯誤
瀏覽:124日期: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. javascript - IOS微信audio標簽不能通過touchend播放2. java-ee - nginx做前端服務器,tomcat+apache做后端,那么war部署在哪里?3. objective-c - iOS開發支付寶和微信支付完成為什么跳轉到了之前開發的一個app?4. 老師百度網盤分享一下WampServer的包啊,我們下載幾kb要下載一天的.5. angular.js - angularjs的自定義過濾器如何給文字加顏色?6. angular.js使用$resource服務把數據存入mongodb的問題。7. docker-machine添加一個已有的docker主機問題8. 關于docker下的nginx壓力測試9. html - 如何用css令背景圖能夠撐滿本身會滾動的頁面?10. 自己安裝了apache2.2,但是重啟apache后出錯了,求解!謝謝!
排行榜
