May-22-2018, 06:21 AM
Hi
I tried in that way also, still getting the same.
I tried in that way also, still getting the same.
import glob import connect_to_hbase import os import csv import testingsun1 #Changing to the directory path to search for the directory name containing "GSK" table = connect_to_hbase.conn.table(connect_to_hbase.table_name_Target) base_path = '/ai2/data/dev/admin/inf/*{}*' patterns = testingsun1.z #x = table.row(row.serialnum) for pattern in patterns: search_path = base_path.format(pattern) for f in glob.glob(search_path): print("-----------------------") print ("The directory path is:") print f print("List of files in the directory are:") os.chdir('/ai2/data/dev/admin/inf/') os.chdir(f) cwd = os.getcwd() for subdir, dirs, files in os.walk(cwd, topdown=True): for file23 in glob.glob('*.err'): print file23 with open(file23) as f: strings = f.read() search_word = 'checksum' search_word1 = 'Threshold' if(search_word1 in strings): with open('/ai2/data/dev/serial/sys/sys_ath_pvt/main/qv_thresholdhistory.csv','r') as csvfile: readCSV = csv.reader(csvfile, delimiter=',') next(readCSV, None) for row in readCSV: #print row[2] #print os.path.splitext(file23)[0] if(os.path.splitext(file23)[0] in row[2]): if row[5] and row[9]: if(int(row[5]) - int(row[9]) >= 0): a = row[3].split("|") b = row[4].split("|") recom=b[1] app_id=row[0] entity=row[2] existing=a[1] data_control=search_word1 store=recom,app_id,entity,existing,data_control print(store) for i in range(20): table.put('row-%04d' % i, {'APP_VALUES:SEGMENT':'','APP_VALUES:API_KEY':'','APP_VALUES:RECOMMENDED_VALUE':a[0], 'APP_VALUES:APPLICATION_NAME':a[10],'APP_VALUES:ENTITY_NAME':a[2],'APP_VALUES:EXISTING_VALUE':a[3],'APP_VALUES:DATA_CONTROL':a[4],'APP_VALUES:APPLICATION_ID':a[1]}) else: print ("word not found")