{"record":{"id":"5a369f87b3e64d23","repo":"FujiwaraChoki/MoneyPrinterV2","slug":"could-not-locate-extracted-google-maps-scraper-dir","errorCode":null,"errorMessage":"Could not locate extracted google-maps-scraper directory.","messagePattern":"Could not locate extracted google-maps-scraper directory\\.","errorType":"error_code","errorClass":"FileNotFoundError","httpStatus":null,"severity":"error","filePath":"src/classes/Outreach.py","lineNumber":103,"sourceCode":"    def build_scraper(self) -> None:\n        \"\"\"\n        Build the scraper.\n\n        Returns:\n            None\n        \"\"\"\n        binary_name = (\n            \"google-maps-scraper.exe\"\n            if platform.system() == \"Windows\"\n            else \"google-maps-scraper\"\n        )\n        if os.path.exists(binary_name):\n            print(colored(\"=> Scraper already built. Skipping build.\", \"blue\"))\n            return\n\n        scraper_dir = self._find_scraper_dir()\n        if not scraper_dir:\n            raise FileNotFoundError(\n                \"Could not locate extracted google-maps-scraper directory.\"\n            )\n\n        subprocess.run([\"go\", \"mod\", \"download\"], cwd=scraper_dir, check=True)\n        subprocess.run([\"go\", \"build\"], cwd=scraper_dir, check=True)\n\n        built_binary = os.path.join(scraper_dir, binary_name)\n        if not os.path.exists(built_binary):\n            raise FileNotFoundError(f\"Expected built scraper binary at: {built_binary}\")\n\n        os.replace(built_binary, binary_name)\n\n    def run_scraper_with_args_for_30_seconds(self, args: str, timeout=300) -> None:\n        \"\"\"\n        Run the scraper with the specified arguments for 30 seconds.\n\n        Args:\n            args (str): The arguments to run the scraper with.","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/FujiwaraChoki/MoneyPrinterV2/blob/5192af8eca97759f941834b947e3ceb209da0649/src/classes/Outreach.py#L85-L121","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Run the repo's setup/preflight scripts (scripts/setup_local.sh, scripts/preflight_local.py) which prepare the scraper source","Manually download and extract the google-maps-scraper release into the expected location","Inspect _find_scraper_dir's expected name pattern and rename the extracted directory to match"],"exampleFix":"// before\noutreach.start()  # FileNotFoundError: Could not locate extracted google-maps-scraper directory.\n\n// after\n# extract the scraper source first, then build\nimport subprocess\nsubprocess.run([\"bash\", \"scripts/setup_local.sh\"], check=True)\noutreach.start()","handlingStrategy":"validation","validationCode":"scraper_dir = outreach._find_scraper_dir()\nif not scraper_dir:\n    raise FileNotFoundError(\n        \"Scraper source missing. Run scripts/setup_local.sh to download and extract it.\"\n    )\noutreach.start()","typeGuard":"from pathlib import Path\n\ndef scraper_source_present(expected_dir: str) -> bool:\n    return Path(expected_dir).is_dir() and (Path(expected_dir) / \"go.mod\").is_file()","tryCatchPattern":"try:\n    outreach.start()\nexcept FileNotFoundError as exc:\n    if \"google-maps-scraper\" in str(exc):\n        subprocess.run([\"bash\", \"scripts/setup_local.sh\"], check=True)\n        outreach.start()\n    else:\n        raise","preventionTips":["Run setup scripts after cloning or on fresh environments","Pin the scraper release version so extraction layout stays predictable","Fail the extraction step loudly so a missing directory is caught before build_scraper"],"tags":["python","build","scraper","missing-dependency"],"backgroundTag":"missing-build-artifact","analyzedSha":"5192af8eca97759f941834b947e3ceb209da0649","analyzedAt":"2026-08-28T10:31:46.474Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}