From 40f4348477478a41f2dd71f461fb1e55ea7810a1 Mon Sep 17 00:00:00 2001 From: seagull <24163551@qq.com> Date: Wed, 28 Nov 2018 20:25:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=B0=83PY=E8=84=9A=E6=9C=AC?= =?UTF-8?q?=E6=97=B6=EF=BC=8C=E8=BF=94=E5=9B=9E=E7=BB=93=E6=9E=9C=E5=B0=BE?= =?UTF-8?q?=E9=83=A8=E4=BC=9A=E5=87=BA=E7=8E=B0=E7=A9=BA=E6=A0=BC=E7=9A=84?= =?UTF-8?q?Bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/luckyclient/publicclass/InvokeMethod.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/luckyclient/publicclass/InvokeMethod.java b/src/main/java/luckyclient/publicclass/InvokeMethod.java index 7a14f50..a172722 100644 --- a/src/main/java/luckyclient/publicclass/InvokeMethod.java +++ b/src/main/java/luckyclient/publicclass/InvokeMethod.java @@ -451,9 +451,9 @@ public class InvokeMethod { String[] args = new String[2+params]; args[0]="python"; if(packagename.endsWith(File.separator)){ - args[1]=packagename+functionname; //"E:\\PycharmProjects\\untitled\\venv\\testaaa.py"; + args[1]=packagename+functionname; }else{ - args[1]=packagename+File.separator+functionname; //"E:\\PycharmProjects\\untitled\\venv\\testaaa.py"; + args[1]=packagename+File.separator+functionname; } luckyclient.publicclass.LogUtil.APP.info("调用Python脚本路径:"+args[1]); for(int i=0;i < params;i++){ @@ -476,10 +476,10 @@ public class InvokeMethod { proc.waitFor(); // 打印流信息 if(outerrStream.toString().equals("")){ - result = outStream.toString(); + result = outStream.toString().trim(); luckyclient.publicclass.LogUtil.APP.info("成功调用Python脚本,返回结果:"+result); }else{ - result = outerrStream.toString(); + result = outerrStream.toString().trim(); if(result.indexOf("ModuleNotFoundError")>-1){ luckyclient.publicclass.LogUtil.APP.error("调用Python脚本出现异常,有相关Python模块未引用到,请在Python脚本中注意设置系统环境路径(例: sys.path.append(\"E:\\PycharmProjects\\untitled\\venv\\Lib\\site-packages\"))," + "详细错误信息:"+result);