公司的測(cè)試平臺(tái)通過Process process = Runtime.getRuntime().exec("python " + "腳本地址")執(zhí)行python測(cè)試腳本?! ?zhí)行普通的python腳本沒有問題,但是當(dāng)python腳本中引入import xlrd,用Excel表格中獲取數(shù)據(jù)時(shí),通過平臺(tái)以上的方法就無法正常運(yùn)行(生成的日志為空文件)。請(qǐng)教各位大神問題所在?! ×硗?,單獨(dú)在IDE中運(yùn)行從Excel表格中獲取數(shù)據(jù)的python腳本正常。粘部分python代碼如下:def getColumnIndex(table, columnName):columnIndex = Nonefor i in range(table.ncols):if (table.cell_value(0, i) == columnName):columnIndex = ibreakreturn columnIndexdef readInputListByColumnName(fileName, sheetName, columnName):workbook = xlrd.open_workbook(fileName)sheet = workbook.sheet_by_name(sheetName)index = CaseBase.getColumnIndex(sheet, columnName)inputlist = sheet.col_values(index, start_rowx=1)return inputlist
Java調(diào)用getRuntime().exec()執(zhí)行Python腳本后無法讀取Excel中的數(shù)據(jù)
慕蓋茨4494581
2018-08-09 09:18:39