# Gateway Timer Scripts Events

**URL:** <https://forum.inductiveautomation.com/t/gateway-timer-scripts-events/39665>\
**Category:** General Discussion\
**Created:** [October 14, 2020, 3:16pm UTC](https://forum.inductiveautomation.com/t/gateway-timer-scripts-events/39665 "2020-10-14T15:16:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![victor.meza](https://avatars.discourse-cdn.com/v4/letter/v/f08c70/32.png) [@victor.meza](https://forum.inductiveautomation.com/u/victor.meza)\
**Post date:** [October 14, 2020, 3:16pm UTC](https://forum.inductiveautomation.com/t/gateway-timer-scripts-events/39665/1 "2020-10-14T15:16:07Z")

</div>

Hello everyone,

I’m running some timer scripts in order to get some information from a file.asc, it used to work properly but now it seems that the script is not working in this timer script. If I execute manually in the script console it works. I also tried another print in logs script for testing and works.

It is as if the code was empty. This is my script code.  
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::  
import time  
import threading  
import os  
import glob

def getFile():  
import os  
import os.path  
import glob  
import system

```
machine = "MDR 1"
machineFolder = "MDR1"
directory = glob.glob('E:\\' + machineFolder + '\\*.asc')

if len(directory):
	newFile = max(directory, key =os.path.getctime)
	
	previousFile = str(system.tag.read("File Directory/%s" % (machine)).value)

	if str(previousFile) != str(newFile):
		file = open(newFile, "r")
		data = [line for line in file.readlines()]
		file.close()
		system.tag.write("File Directory/%s" % (machine), newFile )
		
		logger = system.util.getLogger("LabTest File Read-%s" %(machine))
		logger.info('New File Available. Parsing file - %s '%(newFile))
		
		return data, machine
	else:
		print 'File is processed !'
		return None, None

else:
	print "Folder has no files"
	return None, None

```

data, machine = getFile()

if data :  
ret = project.LabTesting.parseAlphaFile(data, machine)

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::  
I share with you the thread dumps

Daemon Thread [gateway-script-dedicated-timer-[LabTesting/MDR 1]] id=14689, (TIMED\_WAITING)  
waiting for: java.util.TaskQueue@57aac92  
java.lang.Object.wait(Native Method)  
java.util.TimerThread.mainLoop(Unknown Source)  
java.util.TimerThread.run(Unknown Source)  
Daemon Thread [gateway-script-dedicated-timer-[LabTesting/MDR 2]] id=14687, (TIMED\_WAITING)  
waiting for: java.util.TaskQueue@4d46a8d8  
java.lang.Object.wait(Native Method)  
java.util.TimerThread.mainLoop(Unknown Source)  
java.util.TimerThread.run(Unknown Source)  
Daemon Thread [gateway-script-dedicated-timer-[LabTesting/MV 1]] id=14692, (TIMED\_WAITING)  
waiting for: java.util.TaskQueue@5d2ca7cb  
java.lang.Object.wait(Native Method)  
java.util.TimerThread.mainLoop(Unknown Source)  
java.util.TimerThread.run(Unknown Source)

I hope you can help me out.  
Thanks.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [October 14, 2020, 3:20pm UTC](https://forum.inductiveautomation.com/t/gateway-timer-scripts-events/39665/2 "2020-10-14T15:20:42Z")

</div>

The thread dumps just say the threads are idle in between runs. Look for log entries for script errors.
