FujiwaraChoki/MoneyPrinterV2 · error · FileNotFoundError

Could not locate extracted google-maps-scraper directory.

Error message

Could not locate extracted google-maps-scraper directory.

What it means

Raised by Outreach.build_scraper when _find_scraper_dir cannot locate the extracted google-maps-scraper directory. The Go-based scraper must be built from source, so the build step aborts when the source tree is missing.

Source

Thrown at src/classes/Outreach.py:103

    def build_scraper(self) -> None:
        """
        Build the scraper.

        Returns:
            None
        """
        binary_name = (
            "google-maps-scraper.exe"
            if platform.system() == "Windows"
            else "google-maps-scraper"
        )
        if os.path.exists(binary_name):
            print(colored("=> Scraper already built. Skipping build.", "blue"))
            return

        scraper_dir = self._find_scraper_dir()
        if not scraper_dir:
            raise FileNotFoundError(
                "Could not locate extracted google-maps-scraper directory."
            )

        subprocess.run(["go", "mod", "download"], cwd=scraper_dir, check=True)
        subprocess.run(["go", "build"], cwd=scraper_dir, check=True)

        built_binary = os.path.join(scraper_dir, binary_name)
        if not os.path.exists(built_binary):
            raise FileNotFoundError(f"Expected built scraper binary at: {built_binary}")

        os.replace(built_binary, binary_name)

    def run_scraper_with_args_for_30_seconds(self, args: str, timeout=300) -> None:
        """
        Run the scraper with the specified arguments for 30 seconds.

        Args:
            args (str): The arguments to run the scraper with.

View on GitHub (pinned to 5192af8eca)

Solutions

  1. Run the repo's setup/preflight scripts (scripts/setup_local.sh, scripts/preflight_local.py) which prepare the scraper source
  2. Manually download and extract the google-maps-scraper release into the expected location
  3. Inspect _find_scraper_dir's expected name pattern and rename the extracted directory to match

Example fix

// before
outreach.start()  # FileNotFoundError: Could not locate extracted google-maps-scraper directory.

// after
# extract the scraper source first, then build
import subprocess
subprocess.run(["bash", "scripts/setup_local.sh"], check=True)
outreach.start()
Defensive patterns

Strategy: validation

Validate before calling

scraper_dir = outreach._find_scraper_dir()
if not scraper_dir:
    raise FileNotFoundError(
        "Scraper source missing. Run scripts/setup_local.sh to download and extract it."
    )
outreach.start()

Type guard

from pathlib import Path

def scraper_source_present(expected_dir: str) -> bool:
    return Path(expected_dir).is_dir() and (Path(expected_dir) / "go.mod").is_file()

Try / catch

try:
    outreach.start()
except FileNotFoundError as exc:
    if "google-maps-scraper" in str(exc):
        subprocess.run(["bash", "scripts/setup_local.sh"], check=True)
        outreach.start()
    else:
        raise

Prevention

When it happens

Trigger: Running start() without having downloaded/extracted the google-maps-scraper archive, the archive extracting to an unexpectedly named directory, or the extraction step silently failing earlier in the flow.

Common situations: Fresh clone without running setup scripts, a scraper release whose zip layout changed so the expected directory name no longer matches, or partial/interrupted downloads.

Related errors


AI-assisted analysis of FujiwaraChoki/MoneyPrinterV2@5192af8eca (2026-08-28). Data as JSON: /api/errors/5a369f87b3e64d23. Report an issue: GitHub.