用Execute Windows batch command执行python脚本

jenkins执行windows命令报错,本地命令行是成功的

img

img

在jenkins就失败报错如下:

img

哪位遇到过这样的问题请教一下

Jenkins 执行Python脚本以及Bat(批处理)脚本
https://blog.csdn.net/guorong520/article/details/103926201

在程序第一行添加编码信息

coding: cp1252

首先文件保存格式用utf-8
其次python文件指定编码格式

# coding=utf-8

img

首行添加:

#!/usr/bin/env python
# -*- coding: utf-8 -*-

或者参考: https://blog.csdn.net/nanxun_198/article/details/121236475

如果还有问题, 可能是因为有不识别的字符, 建议 重新建个文件, 把代码纯手打一遍, 不要复制粘贴


# This Python file uses the following encoding: utf-8

将上面代码放到第一行
记得jekins也要设置成utf-8

https://blog.csdn.net/weixin_57805858/article/details/126763774 不知道这个有没有用