def render_executables():
    # load up scenario data
    data = json.load(open('scenario.cache','r'))
    lookup = TemplateLookup(directories=['./scenarios'])

    for path in glob2.glob('./scenarios/**/request.mako'):
        event_name = path.split('/')[-2]
        template = Template(filename=path, lookup=lookup,)
        try:
            request = data[event_name].get('request', {})
            payload = request.get('payload')
            text = template.render(api_key=data['api_key'],
                                   request=request, payload=payload).strip()
        except __HOLE__:
            text = ''
            print colors.YELLOW + "WARN: Skipped {} since {} not in scenario.cache".format(
                path, event_name) + colors.RESET
        with open(os.path.join(os.path.dirname(path),
                               'executable.py'), 'w+') as write_to:
            write_to.write(text)
dataset/ETHPy150Open balanced/balanced-python/render_scenarios.py/render_executables