From 173fbb9b6b3b5ba2fef6f2f739e93a718e5f9f8e Mon Sep 17 00:00:00 2001 From: David Dalcino Date: Fri, 29 Oct 2021 10:55:30 -0700 Subject: [PATCH] Add suggestion on MemoryError to use external 7z --- aqt/installer.py | 9 +++++++-- tests/test_install.py | 8 ++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/aqt/installer.py b/aqt/installer.py index 17d51bb..9beddca 100644 --- a/aqt/installer.py +++ b/aqt/installer.py @@ -850,14 +850,19 @@ def run_installer(archives: List[QtPackage], base_dir: str, sevenzip: Optional[s raise CliKeyboardInterrupt("Installer halted by keyboard interrupt.") from e except MemoryError as e: close_worker_pool_on_exception(e) + alt_extractor_msg = ( + "Please try using the '--external' flag to specify an alternate 7z extraction tool " + "(see https://aqtinstall.readthedocs.io/en/latest/cli.html#cmdoption-list-tool-external)" + ) if Settings.concurrency > 1: docs_url = "https://aqtinstall.readthedocs.io/en/stable/configuration.html#configuration" raise OutOfMemory( "Out of memory when downloading and extracting archives in parallel.", - suggested_action=[f"Please reduce your 'concurrency' setting (see {docs_url})"], + suggested_action=[f"Please reduce your 'concurrency' setting (see {docs_url})", alt_extractor_msg], ) from e raise OutOfMemory( - "Out of memory when downloading and extracting archives.", suggested_action=["Please free up more memory."] + "Out of memory when downloading and extracting archives.", + suggested_action=["Please free up more memory.", alt_extractor_msg], ) except Exception as e: close_worker_pool_on_exception(e) diff --git a/tests/test_install.py b/tests/test_install.py index 2a0b7bb..0fbe6c1 100644 --- a/tests/test_install.py +++ b/tests/test_install.py @@ -614,7 +614,9 @@ def test_install_nonexistent_archives(monkeypatch, capsys, cmd, xml_file: Option "Out of memory when downloading and extracting archives in parallel.\n" "==============================Suggested follow-up:==============================\n" "* Please reduce your 'concurrency' setting (see " - "https://aqtinstall.readthedocs.io/en/stable/configuration.html#configuration)", + "https://aqtinstall.readthedocs.io/en/stable/configuration.html#configuration)\n" + "* Please try using the '--external' flag to specify an alternate 7z extraction tool " + "(see https://aqtinstall.readthedocs.io/en/latest/cli.html#cmdoption-list-tool-external)", 1, ), ( @@ -623,7 +625,9 @@ def test_install_nonexistent_archives(monkeypatch, capsys, cmd, xml_file: Option "Caught MemoryError, terminating installer workers\n" "Out of memory when downloading and extracting archives.\n" "==============================Suggested follow-up:==============================\n" - "* Please free up more memory.", + "* Please free up more memory.\n" + "* Please try using the '--external' flag to specify an alternate 7z extraction tool " + "(see https://aqtinstall.readthedocs.io/en/latest/cli.html#cmdoption-list-tool-external)", 1, ), ),