[英]execute python file from python script with arguments{jenkins]
我正在运行一个 python 脚本。 环境:Windows10 python 版本:2.7.14 我试图在 jenkins 中运行这个文件执行批处理命令(通常用于 Windows 命令行选项)这是代码。
p1.py:
import subprocess
command="C:/users/python test1.py C:/Users/test1.html"
subprocess.call(command,shell=True)
从 Jenkins 运行时它总是抛出错误:
C:\Python27\python.exe: can't find '__main__' module in 'C:\\Users\\'
C:\Users\test\.jenkins\workspace\test1>python p1.py
python: can't open file 'p1.py': [Errno 2] No such file or directory
但是当我从命令提示符运行它时同样有效。
我在这里缺少什么吗?
我试过
os.system("python p1.py test1.html")
但我得到了同样的错误。
我使用exec(open(“myfile.py”).read())
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.