subprocess.Popen及其参数的最大字符长度

时间:2017-05-23 06:04:31

标签: python subprocess

我的python代码中有一个相当简单的行:

cfile

这一行有一个错误,我最终意识到输入文件cfile的名称太长了。因此,我遇到了分段错误。我知道这一定是问题所在,因为我可以使用较短的cfile路径运行相同的代码并且它可以正常工作。

问题是名称cwd=dir可以多长时间?如果我还有dir,我对import os import subprocess dir="/scratch" cfile="/home/user/simulation_data/2017_systemBC_efield/BCline01/bssecorrection/bsseE=0+H2(1)/scan_0000/bsse/coord" xyz="temp.xyz" denv=dict(os.environ) with open(xyz,"w") as h: p1=subprocess.Popen(["t2x",coordfile],env=denv,cwd=dir,stdout=h) p1.wait() 的字符数也有限制吗?我们可以绕过这些限制吗?

以下是有问题的代码和错误消息:

Taking coordinates from file:  /home/user/simulation_data/2017_systemBC_efield/BCline01/bssecorrection/bsseE=0+H2(1)/scan_0000/bsse/coord
No structure optimization data found.
Only coord data will be converted.
Segmentation fault (core dumped)
Segmentation fault (core dumped)
Segmentation fault (core dumped)
Segmentation fault (core dumped)
Segmentation fault (core dumped)

错误讯息:

MySQL

0 个答案:

没有答案