예제 #1
0
def run_nodejs(filename, task):
    try:
        log('Attempting to ' + task + '...', 'info')
        subprocess.run(['node', filename])
    except Exception as e:
        log('Failed to ' + task + ': ', 'error')
        util.exception_thrown()
        quit()
예제 #2
0
def download_and_parse(url, xml, json):
    try:
        log('Downloading ' + url + '...', 'info')
        urlretrieve(url, xml)
    except Exception as e:
        log('While downloading:', 'error')
        util.exception_thrown()
        quit()

    try:
        log('Parsing ' + xml + '...', 'info')
        sdn_parser.parse_to_file(xml, json)
    except Exception as e:
        log('While parsing:' + str(e), 'error')
        log(sys.exc_info, 'error')
        quit()