我正在尝试通过shell脚本postprocess.py
运行Python脚本Allrun.sh
。
我手动执行Python脚本时工作正常,但运行Allrun.sh
时出错。
#!/bin/bash
# File: Allrun.sh
python postprocess.py
这是postprocess.py
的短段,为
for files in os.listdir("."):
if files.endswith(".stl"):
STLfile = files
f = open(STLfile,'r')
错误:
第797行,在PostProcessing中 f = open(STLfile,'r')NameError:名称'STLfile'未定义
但是,目录中确实存在.stl
文件。