markup: delete any preexisting xls before processing

This commit is contained in:
2020-03-12 15:38:42 -07:00
parent 62f2a4b2d9
commit 7fef29d00f

View File

@ -72,6 +72,11 @@ def process_markup_pdf(pdf_path, username):
print(f'No pdf - exiting ({pdf_path})')
return
dest_xls_path = dest_spreadsheet_path(pdf_path)
if os.path.isfile(dest_xls_path):
print(f'deleting preexisting xls {dest_xls_path}')
os.remove(dest_xls_path)
user = User.objects.get(username=username)
work_dir = workdir(user.username, pdf_path)
@ -105,8 +110,6 @@ def process_markup_pdf(pdf_path, username):
print(f'error creating spreadsheet')
return
dest_xls_path = dest_spreadsheet_path(pdf_path)
print(f'wrote spreadsheet: {work_xls_path}')
print(f'copying xls to {dest_xls_path}')