diff --git a/markup/tasks.py b/markup/tasks.py index de01024..252fe5e 100644 --- a/markup/tasks.py +++ b/markup/tasks.py @@ -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}')