簡體   English   中英

在我的 python 代碼中停止 subprocess.call 循環

[英]stopping a subprocess.call loop in my python code

def raspi_connecter():
    print("Below is the output from the shell script in terminal")
    subprocess.call('ssh dev@X.0.0.X', shell=True)

該代碼在我的 GUI 程序中打開了我的 raspi,但是當我點擊窗口上的其他按鈕(執行命令、更新、導入文件)時,我的 Mac 出現了死亡彩虹輪。 我認為這是因為它陷入了一個開環,但也許是錯的?

Popen 會比 .call 更好嗎?

使用 Popen 應該是最好的選擇。 查看文檔以獲取更多信息https://docs.python.org/3/library/subprocess.html

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM