文章詳情頁
python 利用subprocess庫調用mplayer時發生錯誤
瀏覽:64日期: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. mysql - 新浪微博中的關注功能是如何設計表結構的?2. android-studio - Android Studio 運行項目的時候一堆警告,跑步起來!?3. MySQL數據庫中文亂碼的原因4. angular.js使用$resource服務把數據存入mongodb的問題。5. 如何解決Centos下Docker服務啟動無響應,且輸入docker命令無響應?6. angular.js - 關于$apply()7. dockerfile - [docker build image失敗- npm install]8. 表單提交驗證,沒反應,求老師指點9. angular.js - Ionic 集成crosswalk后生成的apk在android4.4.2上安裝失敗???10. 我在centos容器里安裝docker,也就是在容器里安裝容器,報錯了?
排行榜
