【发布时间】:2018-05-01 05:01:00
【问题描述】:
我有一段代码:
temp_dir = "/tmp/working"
p = subprocess.Popen(["python3", temp_dir + "/tmp.py"])
但是当我在 Linux Mint 18 的 bash 中运行代码时,我得到了OSError: [Errno 7] Argument list too long。但是当我在 Fedora、macOS、FreeBSD、Ubuntu 中进行测试时(它们有很多 shell:fish、zsh、...)我没有t 收到任何错误。即使我使用
print(subprocess.check_call(["python3", temp_dir + "/tmp.py"], shell=True))
,出现了同样的错误。
命令真的很短,我不知道为什么会出现这个错误。
我有数百个结果,但我无法解决我的问题。
【问题讨论】:
-
tmp.py是否包含任何子进程调用? -
没有。
tmp.py是一个小代码,它只包含print('something')。 -
你需要增加你的ulimit -s unix.stackexchange.com/a/401797
标签: python python-3.x