def insert(generator, table_name, log_filename): gw2db = Gw2Database(autocommit = True) counter = 0 print('Inserting...') log = Log(log_filename, paths.logs) log.write(str(gw2db.get_columns(table_name)), end='\n\n') for row in generator: print(row) try: gw2db.insert_to_table(table_name, *row) except: counter += 1 log.write(str(row)) log.write(str(sys.exc_info()[1]), end = ' ') log.write('--------------------------') print('Done') log.write('{} rows were not inserted'.format(counter)) log.write('Log created {}'.format(str(datetime.datetime.now())))
from utilities.log import Log import logging import numpy as np from ate_settings import * import re DEBUG_MODE = False # global logging variable # instantiated once first time this module is loaded # Five log levels - CRITICAL, ERROR, WARNING, INFO, and DEBUG # For development, set to DEBUG. For production, set to WARNING. if DEBUG_MODE == True: log = Log(logging.DEBUG) else: log = Log(logging.INFO) DEVICE_TYPE = 'Diana' MCU = 'Apollo2' FONT_FILE_PATH = '/home/pi/misfit/ShineProduction/newATE/tests/diana_fonts_unhinted_cjk.fmp' PROJECT_PATH = '/home/pi/misfit/ShineProduction/newATE/' DESKTOP_PATH = "/home/pi/Desktop/" # projects projectList = ["Diana"] #=============================================================================== # STATION SOFTWARE VERSION #=============================================================================== #Version scheme is defined as #<station_type>.<product>.<major>.<minor>.<internal_rev>.<prod | dev> STATION = "ATE" # Can be either ATE or RMA