Here is the code. What I need to do is find a way to make 'i' global so that upon repeated executions the value of 'i' will increment by 1 instead of being reset to 0 everytime. The code in 'main' is from another script that I embed in 'main' in order to have the trace function work. This is all being done from Java.
from __future__ import nested_scopes
import sys
import time
startTime = time.time()
timeLimit = 5000
def traceit(frame, event, arg):
if event == "line":
elapsedTime = ((time.time() - startTime)*1000)
if elapsedTime > timeLimit:
raise Exception, "The execution time has exceeded the time limit of " + str(timeLimit) + " milliseconds. Script will now terminate"
return traceit
sys.settrace(traceit)
def main______():
try:
i+=1
except NameError:
i=1
main______()