【发布时间】:2016-08-08 09:24:53
【问题描述】:
#我正在尝试运行插件文件夹中的所有 bash 脚本
import sys,os,subprocess
folder_path=os.listdir(os.path.join(os.path.dirname(__file__),'plugins'))
sys.path.append(os.path.join(os.path.dirname(__file__),'plugins'))
for file in folder_path:
if file == '~':
continue
elif file.split('.')[1]=="sh":
print file
subprocess.call(['./plugins/${file} what'],shell=True,executable='/bin/bash')
it shows error:
bash: /bin/bash: ./plugins/: Is a directory
【问题讨论】:
标签: python bash subprocess