文章詳情頁
python 利用subprocess庫調(diào)用mplayer時發(fā)生錯誤
瀏覽:188日期: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. java - SSH框架中寫分頁時service層中不能注入分頁類2. docker-compose中volumes的問題3. docker安裝后出現(xiàn)Cannot connect to the Docker daemon.4. boot2docker無法啟動5. docker網(wǎng)絡(luò)端口映射,沒有方便點(diǎn)的操作方法么?6. javascript - mock.js可以存儲數(shù)據(jù)嗎7. 如何使用git對word文檔進(jìn)行版本控制?8. java - Spring事務(wù)回滾問題9. javascript - vue生成一維碼?求助?。。。。〖?/a>10. nignx - docker內(nèi)nginx 80端口被占用
排行榜

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