python - 在我的 python 代码中停止 subprocess.call 循环
问题描述
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
推荐阅读
- cython - 返回类型为 void*(void 指针)时忽略 cython 异常
- python - 神经网络总是在每个 epoch 中预测相同的类别
- locale - 在 React-Admin v3 中设置页面加载的语言环境
- java - 检测到的 JDK 版本:11.0.8 不在允许范围内 [1.8.0-101,1.8.9999]
- php - local.ERROR: App\Measure::getData() 的返回值必须是 Illuminate\Support\Collection 的实例,没有返回
- python - 具有 2 种不同数据类型的结构化 numpy 数组
- webpack - Gatsby / WebPack:如何在构建时仅构建使用过的组件
- twitter-bootstrap - 引导轮播循环
- sql - Oracle SQL Query 根据另一个表的条件更改列标题
- c# - 在winforms C#中自动隐藏图片