我想从Katalon工作室执行python脚本。
下面是我试图从Katalon执行的代码。
def scriptPath = "/Users/amiteshshukla/Documents/Work/highRoads/docgen_validation/docgen_validation.py"
def command = "python $scriptPath"
def result = command.execute().text
println result
return result
这是我要执行的python脚本。
#!/usr/bin/env python3
class DocgenValidator:
print("THis is one of the check***************")
def __init__(self, baseline_doc_path: str, updated_doc_path: str):
# Validating inputs
if not isinstance(baseline_doc_path, str) or baseline_doc_path is None:
raise TypeError(f" Expected {baseline_doc_path} to be of type str, got {type(baseline_doc_path).__name__}")
if not isinstance(updated_doc_path, str) or updated_doc_path is None:
raise TypeError(f" Expected {updated_doc_path} to be of type str, got {type(updated_doc_path).__name__}")
self.baseline_doc_path = baseline_doc_path
self.updated_doc_path = updated_doc_path
self.WORD_NAMESPACE = '{http://schemas.openxmlformats.org/wordprocessingml/2006/main}'
self.PARA = self.WORD_NAMESPACE + 'p'
self.TEXT = self.WORD_NAMESPACE + 't'
print("THis is one of the check***************")
但是在输出中,我看到了:
SLF4J: The requested version 1.7.16 by your slf4j binding is not compatible with [1.6]
SLF4J: See http://www.slf4j.org/codes.html#version_mismatch for further details.
2019-05-15 13:48:09.562 INFO c.k.katalon.core.main.TestCaseExecutor - --------------------
2019-05-15 13:48:09.567 INFO c.k.katalon.core.main.TestCaseExecutor - START Test Cases/PythonRead
2019-05-15 13:48:10.400 DEBUG testcase.PythonRead - 1: scriptPath = "/Users/amiteshshukla/Documents/Work/highRoads/docgen_validation/docgen_validation.py"
2019-05-15 13:48:10.402 DEBUG testcase.PythonRead - 2: command = python $scriptPath
2019-05-15 13:48:10.417 DEBUG testcase.PythonRead - 3: result = text
2019-05-15 13:48:10.537 DEBUG testcase.PythonRead - 4: println(result)
2019-05-15 13:48:10.541 DEBUG testcase.PythonRead - 5: return result
2019-05-15 13:48:10.544 INFO c.k.katalon.core.main.TestCaseExecutor - END Test Cases/PythonRead