文章詳情頁
python 利用subprocess庫調(diào)用mplayer時發(fā)生錯誤
瀏覽:204日期:2022-09-13 17:22:57
問題描述
腳本在讀取stdout時卡住,不再繼續(xù)執(zhí)行,也不發(fā)生終止
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標(biāo)簽問題下一條:python - pandas dataframe如何對某列的空數(shù)據(jù)位置進(jìn)行update?update的函數(shù)是自定義的,參數(shù)是同一行的另外兩列數(shù)據(jù)
相關(guān)文章:
1. javascript - immutable配合react提升性能?2. javascript - sublime快鍵鍵問題3. 配置Apache時,添加對PHP的支持時語法錯誤4. Apache 已經(jīng)把網(wǎng)站根目錄的改為allow from all了,但是服務(wù)器還是不能訪問?5. css - 寫頁面遇到個布局問題,求大佬們幫解答,在線等,急!~6. phpstudy8.1支持win11系統(tǒng)嗎?7. javascript - nodejs關(guān)于進(jìn)程間發(fā)送句柄的一點疑問8. 實現(xiàn)bing搜索工具urlAPI提交9. vue.js - Vue 如何像Angular.js watch 一樣監(jiān)聽數(shù)據(jù)變化10. javascript - 移動端上不能實現(xiàn)拖拽布局嗎?
排行榜

熱門標(biāo)簽
網(wǎng)公網(wǎng)安備