fix: moved faillable statements into a try block
This commit is contained in:
@@ -145,14 +145,13 @@ def main(driver: WebDriver, logger = logging.getLogger('main')):
|
|||||||
try:
|
try:
|
||||||
file = Path('template.xlsx').resolve()
|
file = Path('template.xlsx').resolve()
|
||||||
template = openpyxl.load_workbook(file)
|
template = openpyxl.load_workbook(file)
|
||||||
|
header = next(data)
|
||||||
|
source = template.active
|
||||||
|
output = BytesIO()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.critical('Unable to load template excel', exc_info=e)
|
logger.critical('Unable to load template excel', exc_info=e)
|
||||||
return 7
|
return 7
|
||||||
|
|
||||||
header = next(data, None)
|
|
||||||
source = template.active
|
|
||||||
output = BytesIO()
|
|
||||||
|
|
||||||
def preprocess(data: str):
|
def preprocess(data: str):
|
||||||
try: return float(data)
|
try: return float(data)
|
||||||
except ValueError: pass
|
except ValueError: pass
|
||||||
@@ -172,7 +171,7 @@ def main(driver: WebDriver, logger = logging.getLogger('main')):
|
|||||||
source[coord] = value
|
source[coord] = value
|
||||||
|
|
||||||
sheet = template.copy_worksheet(source)
|
sheet = template.copy_worksheet(source)
|
||||||
sheet.title = 'Copy'
|
sheet.title = "COPY"
|
||||||
logger.debug('%s', sheet.title)
|
logger.debug('%s', sheet.title)
|
||||||
|
|
||||||
if not len(template.worksheets) > 1:
|
if not len(template.worksheets) > 1:
|
||||||
|
|||||||
Reference in New Issue
Block a user