import subprocess
sample_file_directory = "..." # directory where file is
SCRIPT_DIR = "..." # directory where script is
p = subprocess.Popen([SCRIPT_DIR,sample_file_directory,'min','edgelen'],stdout=subprocess.PIPE,stderr=subprocess.PIPE)
min_side_len, err = p.communicate()
print len(err)
所以我有这个脚本来分析 .ply 文件(3d 文件格式)并给我关于文件的数据。我试图在我的目录中找出哪些文件已损坏,哪些没有。所以我试图使用子进程库来运行脚本来查找 .ply 文件的任意特征(在这种情况下是最小边长)如果 err 中有任何内容,则意味着它无法检索任意特征并且文件已损坏。在这里,我只在一个文件上运行它。但是,我不断收到错误消息。
p = subprocess.Popen([SCRIPT_DIR,sample_file_directory,'min','edgelen'],stdout=subprocess.PIPE,stderr=subprocess.PIPE)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 679, in __init__
errread, errwrite)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1249, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
谁能帮我弄清楚为什么我会收到这个错误?我的数据目录和脚本目录都是有效的。另外,很抱歉,如果我遗漏了重要的内容。第一次发帖。