Python脚本在通过shell脚本执行时无法查找/查看文件

时间:2013-06-24 21:20:51

标签: python shell ubuntu stl io

我正在尝试通过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文件。

0 个答案:

没有答案
相关问题