From 2b58cce43fca64865292ccb967b8800a421e05cd Mon Sep 17 00:00:00 2001 From: Joseph Turian Date: Sun, 11 Sep 2022 12:19:16 +0200 Subject: [PATCH] Attempted to warn on #984 and #1014 --- archivebox/extractors/__init__.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/archivebox/extractors/__init__.py b/archivebox/extractors/__init__.py index dc1b9692..ce2ff365 100644 --- a/archivebox/extractors/__init__.py +++ b/archivebox/extractors/__init__.py @@ -7,6 +7,7 @@ from typing import Optional, List, Iterable, Union from datetime import datetime, timezone from django.db.models import QuerySet +from ..core.settings import ERROR_LOG from ..index.schema import Link from ..index.sql import write_link_to_sql_index from ..index import ( @@ -127,10 +128,25 @@ def archive_link(link: Link, overwrite: bool=False, methods: Optional[Iterable[s # print('{black} X {}{reset}'.format(method_name, **ANSI)) stats['skipped'] += 1 except Exception as e: + # Disabled until https://github.com/ArchiveBox/ArchiveBox/issues/984 + # and https://github.com/ArchiveBox/ArchiveBox/issues/1014 + # are fixed. + """ raise Exception('Exception in archive_methods.save_{}(Link(url={}))'.format( method_name, link.url, )) from e + """ + # Instead, use the kludgy workaround from + # https://github.com/ArchiveBox/ArchiveBox/issues/984#issuecomment-1150541627 + with open(ERROR_LOG, "a", encoding='utf-8') as f: + command = ' '.join(sys.argv) + ts = datetime.now(timezone.utc).strftime('%Y-%m-%d__%H:%M:%S') + f.write(("\n" + 'Exception in archive_methods.save_{}(Link(url={}))'.format( + method_name, + link.url, + ) + "\n")) + #f.write(f"\n> {command}; ts={ts} version={config['VERSION']} docker={config['IN_DOCKER']} is_tty={config['IS_TTY']}\n") # print(' ', stats)