Python script optomisation

So seems to be that this line;

multiRowPrepUpdate

is the cause. Running it in the script console, or on a gateway event, won’t write anything to the db. It will on an action performed button in a client for some reason. I could change this to system.db.runPrepUpdate, as my script in the 1st post does execute and write to the db, but then I’d be back to my original issue once I exceed 30k entries, and also the filepath error.

So I tried the store and forward suggestion, and also combining the try/except for filepath

here is the script, works well, a little slower but we have a 7 hour window to gather the data.

[code]if newValue.value:
cells = range(150,166)

#get the date and month of yesterday
from java.util import Date, Calendar
now = Calendar.getInstance()
now.add(Calendar.DATE, -1)
yesterday = Date(now.getTimeInMillis())
yday = system.db.dateFormat(yesterday,"dd")
month = system.db.dateFormat(yesterday,"MM")

#build list of strings to search for
string_1 = "NOREAD"
string_2 = "cu to rotate to slide"
string_3 = "center unit to rotate to robot"
string_4 = "closing gripper 2"
string_5 = "closing gripper 2"
string_6 = "LEC Output 2 reset"
string_7 = "LEC Output 1 Set"
string_8 = "LEC Output 2 set"
string_9 = "LEC Output 1 reset"
string_10 = "LEC Output 0 set"
string_11 = "LEC Output 0 reset"
string_12 = "Slide transfer in"

strings = [string_1]
#strings = [string_1, string_2, string_3, string_4, string_5, string_6, string_7, string_8, string_9, string_10, string_11, string_12]

for cell in cells:
	filepath = "\\\selcfts" + str(cell) + "\\SEL\\Logs\\" + yday + "_Handling.log"
	try:
		file = open(filepath)
		print "Success reading ", filepath
		for line in file:
			for string in strings:
				if line.find(string) != -1:
					system.db.runSFPrepUpdate("INSERT INTO logdata (time, string, cell, date) VALUES (?,?,?,?)", [line[:12], string, cell, month + "/" + yday + "/2016"], datasources=["MsSQL"])
		file.close()
	except:
		print "Error reading ", filepath[/code]

Chris, sorry I meant other data is live, this data will never be live as we can’t look at the log files when the cells are writing to them.