gpt4 book ai didi

Python的subprocess.Popen()及源码

转载 作者:太空狗 更新时间:2023-10-30 02:06:40 27 4
gpt4 key购买 nike

<分区>

我尝试调试的第三方 Python 2.5 脚本让我陷入困境。脚本的相关部分是:

       proc = subprocess.Popen(
"ls && source houdini_setup",
shell = True,
executable = "/bin/bash",
)

有一个守护进程监听5001端口并运行上面的脚本。当脚本运行时,它失败并出现以下错误:

_cygwin.py
houdini_setup
... (more files) ...
/bin/sh: line 0: source: houdini_setup: file not found

houdini_setup 文件非常多,如 ls 所示,事实上,如果我在上面的脚本中将“source”更改为“cat”,脚本会按预期打印 houdini_setup 的内容。此外,在真正的 bash shell 中运行上述命令也可以毫无怨言地获取文件。

有人知道这里发生了什么吗?

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com