diff --git a/archivebox/config.py b/archivebox/config.py index 6c96a9f8..07fe4a4b 100644 --- a/archivebox/config.py +++ b/archivebox/config.py @@ -1097,7 +1097,7 @@ def setup_django(out_dir: Path=None, check_db=False, config: ConfigDict=CONFIG, with open(settings.ERROR_LOG, "a+") as f: command = ' '.join(sys.argv) ts = datetime.now().strftime('%Y-%m-%d__%H:%M:%S') - f.write(f"\n> {command}; ts={ts} version={VERSION} docker={IN_DOCKER} is_tty={IS_TTY}\n") + f.write(f"\n> {command}; ts={ts} version={config['VERSION']} docker={config['IN_DOCKER']} is_tty={config['IS_TTY']}\n") if check_db: sql_index_path = Path(output_dir) / SQL_INDEX_FILENAME diff --git a/archivebox/core/settings.py b/archivebox/core/settings.py index a90538be..9c716c16 100644 --- a/archivebox/core/settings.py +++ b/archivebox/core/settings.py @@ -6,7 +6,6 @@ import re import logging from pathlib import Path -from datetime import datetime from django.utils.crypto import get_random_string from ..config import ( # noqa: F401 diff --git a/archivebox/core/wsgi.py b/archivebox/core/wsgi.py index 59b3d75a..94993b92 100644 --- a/archivebox/core/wsgi.py +++ b/archivebox/core/wsgi.py @@ -7,7 +7,6 @@ For more information on this file, see https://docs.djangoproject.com/en/2.1/howto/deployment/wsgi/ """ -import os from archivebox.config import setup_django setup_django(in_memory_db=False, check_db=True) diff --git a/archivebox/index/sql.py b/archivebox/index/sql.py index c453df1c..d74b836c 100644 --- a/archivebox/index/sql.py +++ b/archivebox/index/sql.py @@ -30,7 +30,6 @@ def remove_from_sql_main_index(snapshots: QuerySet, out_dir: Path=OUTPUT_DIR) -> @enforce_types def write_link_to_sql_index(link: Link): from core.models import Snapshot, ArchiveResult - from index.schema import ArchiveResult as LegacyArchiveResult info = {k: v for k, v in link._asdict().items() if k in Snapshot.keys} tags = info.pop("tags") if tags is None: diff --git a/archivebox/logging_util.py b/archivebox/logging_util.py index d07ec6e4..ab487c04 100644 --- a/archivebox/logging_util.py +++ b/archivebox/logging_util.py @@ -68,7 +68,12 @@ def get_fd_info(fd) -> Dict[str, Any]: IS_TERMINAL = not (IS_PIPE or IS_FILE) IS_LINE_BUFFERED = fd.line_buffering IS_READABLE = fd.readable() - return {key: val for key, val in locals().items() if val is not fd} + return { + 'NAME': NAME, 'FILENO': FILENO, 'MODE': MODE, + 'IS_TTY': IS_TTY, 'IS_PIPE': IS_PIPE, 'IS_FILE': IS_FILE, + 'IS_TERMINAL': IS_TERMINAL, 'IS_LINE_BUFFERED': IS_LINE_BUFFERED, + 'IS_READABLE': IS_READABLE, + } # # Log debug information about stdin, stdout, and stderr