#!/usr/bin/env python
coding:utf-8
import os
import re
filelist=[]
#path = “/Volumes/C/work/veridian/issue/SMP_LAN_DOE/8-3A/”
#path = “/Volumes/C/work/veridian/SPC_calibration/data/”
path = “/Volumes/C/work/6x/issue/cc_acc/nvt_oqc_repeatdata/”
dict = {}
unitID = []
temperature = []
ggTemperature = []
passfail = []
flow = “”
unitID1 = 0
temperature1 = 0
ggTemperature1 = 0
testTime = 0
testflag = “”
filesummay = open(‘issue_report.txt’, ‘w’)
filesummay.write(‘carrierID’)
filesummay.write(’\t’)
filesummay.write(‘SN’)
filesummay.write(’\t’)
filesummay.write(str(‘gg_cc_dsg’))
filesummay.write(’\t’)
filesummay.write(str(‘tester_cc_dsg’))
filesummay.write(’\t’)
filesummay.write(‘test current’)
filesummay.write(’\t’)
filesummay.write(‘gg current’)
filesummay.write(’\t’)
filesummay.write(‘file’)
filesummay.write(’\n’)
errCode = ‘’
for root, dirs, files in os.walk(path):
for name in files:
#print(dir, name)
if name.endswith(".log"):
f=open(os.path.join(root,name),‘r’, encoding=‘gbk’)
filename=(os.path.join(root, name))
#print(filename)
data=f.read()
else:
continue # skip this file
testflag = “Pass”
# temperature1=0
# temperature1=0
# match = re.search(“created unit [ ([A-Z0-9]+) ]”, data, re.MULTILINE)
# if match:
# unitID.append(match.group(1))
# unitID1= match.group(1)
# else:
# unitID1=""
match = re.search(r"tester ID : [ ([A-Z0-9]+) ]", data, re.MULTILINE)
if match:
unitID.append(match.group(1))
unitID1 = match.group(1)
# print(unitID1)
else:
unitID1 = “”
‘’’ flowID
match = re.search(r"flow is:[ (\d+) ]", data, re.MULTILINE)
if match:
# unitID.append(match.group(1))
flow = match.group(1)
#print(flow)
else:
flow = “”
# Voltage b = [
‘’’
# Serial Number
match = re.search(r"Serial Number =(\w+)", data, re.MULTILINE)
if match:
# unitID.append(match.group(1))
SerialNo = match.group(1)
# print(SerialNo)
else:
SerialNo = “”
# Voltage b = [
#1s gg current = [ -0.500175 ]A
match = re.search(r"1s gg current = [ (-\d+.\d+) ]", data, re.MULTILINE)
if match:
# temperature.append(match.group(1))
dsg_gg = match.group(1)
print(dsg_gg)
else:
dsg_gg = ‘’
# tester read current
match = re.search(
r"tester read curent = [ ((-)?\d+.\d+)",
data,
re.MULTILINE)
if match:
ggTemperature1 = match.group(1)
# ggTemperature.append(match.group(1))
# ggTemperature1 = match.group(2)
else:
ggTemperature1 = ‘’
match = re.search(r"tester read curent = [ ((-)?\d+.\d+)", data, re.MULTILINE)
#match = re.search(r"tester cell voltage = [ ((-)?\d+.\d+)", data, re.MULTILINE)
if match:
# passfail.append(match.group(0))
test_cell = match.group(1)
print(test_cell)
# match = re.search(r"test key [(\w+)",data, re.MULTILINE)
#test_cell = match.group(1)
#print(errCode)
else:
test_cell=""
#match = re.search(r"oqc_ocv_shipping ] | Lower spec [ 0.000000 ] | measurement [ ((-)?\d+.\d+)", data, re.MULTILINE)
match = re.search(r"1s gg current = [ (-\d+.\d+)", data, re.MULTILINE)
if match:
#test_cell = match.group(1)
#print(test_cell)
# passfail.append(match.group(0))
#testflag = “Error”
# match = re.search(r"test key [(\w+)",data, re.MULTILINE)
test_pack = match.group(1)
# print(test_pack)
else:
test_pack=""
filesummay.write(str(unitID1))
filesummay.write('\t')
filesummay.write(str(flow))
filesummay.write('\t')
filesummay.write(str(dsg_gg))
filesummay.write('\t')
filesummay.write(str(ggTemperature1))
filesummay.write('\t')
filesummay.write(test_cell)
filesummay.write('\t')
filesummay.write(test_pack)
filesummay.write('\t')
filesummay.write(filename)
filesummay.write('\n')
errCode = ''
filesummay.close()