从shell脚本调用python脚本。加载模块时出错

时间:2017-03-29 13:58:29

标签: python bash shell

我正在运行一个bash脚本来在多个文件夹中运行python脚本

bash脚本

#!/usr/bin/env bash
#$ -S /bin/bash


    ##performs a task on multiple directories contained within current directory

    curdir=$(pwd)
    for folder in /mydir*; do
      [ -d "$folder" ] && cd "$folder" && python mydir/treeCl.py
    done
    cd $curdir

python脚本

#!/usr/bin/env python
import treeCl
c = treeCl.Collection(input_dir='input', file_format='fasta', trees_dir='trees')
...

错误消息

Traceback (most recent call last):   
File "/mydir/treeCl.py", line 2, in <module>
     import treeCl   
File "/mydir/treeCl.py", line 3, in <module>
     c = treeCl.Collection(input_dir='input', file_format='fasta', trees_dir='trees') AttributeError: 'module' object has no attribute 'Collection'

0 个答案:

没有答案