我正在使用一个包,Automater(https://github.com/1aN0rmus/TekDefense-Automater),包的开发人员使用参数来运行脚本
python Automater.py {params}
但我正试图将其包含到我自己的应用程序中,并试图避免修改他的代码。是否可以通过我的应用程序运行Automater
我试过了
subprocess.call(["python", "automater/Automater.py", "params"])
但这似乎连自动装置都没有。有人能指出我做错了什么吗
层次结构是:
myprogram.py
automater/Automater.py
__init__.py
我做了一些修改,现在改做这个
p = Popen(["python", "automater/Automater.py", query], stdin=PIPE, stdout=PIPE, stderr=PIPE)
output, err = p.communicate(b"input data that is passed to subprocess' stdin")
rc = p.returncode
print output, err, rc
但这只是为错误代码打印0,没有其他要调试的消息
编辑:
经过进一步的实验,我发现我必须在automater的目录中,automater.py才能正常运行,有没有办法在Python中做到这一点?i、 e.移动到目录->;run命令
目前没有回答
相关问题 更多 >
编程相关推荐