PaddlePaddle/PaddleOCR · error · FileNotFoundError

FileNotFoundError: {file_path}

Error message

FileNotFoundError: {file_path}

What it means

Error "FileNotFoundError: {file_path}" thrown in PaddlePaddle/PaddleOCR.

Source

Thrown at paddleocr/_api_client/_http.py:135

                timeout=self._timeout,
            )
        except requests.Timeout as e:
            raise RequestTimeoutError(f"Request timed out: {e}") from e
        except requests.ConnectionError as e:
            raise NetworkError(f"Connection failed: {e}") from e
        _raise_for_response(resp)
        return _job_id_from_response(resp)

    def submit_file(
        self,
        model: str,
        file_path: str,
        optional_payload: dict,
        page_ranges: Optional[str] = None,
        batch_id: Optional[str] = None,
    ) -> str:
        if not os.path.exists(file_path):
            raise FileNotFoundError(file_path)
        data = {
            "model": model,
            "optionalPayload": json.dumps(optional_payload),
        }
        if page_ranges is not None:
            data["pageRanges"] = page_ranges
        if batch_id is not None:
            data["batchId"] = batch_id
        try:
            with open(file_path, "rb") as f:
                resp = self._session.post(
                    self._jobs_url,
                    data=data,
                    files={"file": f},
                    timeout=self._timeout,
                )
        except requests.Timeout as e:
            raise RequestTimeoutError(f"Request timed out: {e}") from e

View on GitHub (pinned to 2661c7c0ef)

Solutions

  1. Check that the file path exists and is spelled correctly; use an absolute path to avoid working-directory issues.
  2. Ensure the process has read permission on the file.
  3. Verify you passed file_path (a local file) and not file_url (a remote URL).

Example fix

import os
path = os.path.abspath(file_path)
assert os.path.exists(path), path  # resolve and verify before submitting

When it happens

Trigger: Raised by submit_file() when the given local file_path does not exist on disk.

Common situations: The local file to upload does not exist at the given path. Check for typos, relative-path resolution against the current working directory, and that the file was not moved or deleted.


AI-assisted analysis of PaddlePaddle/PaddleOCR@2661c7c0ef (2026-08-14). Data as JSON: /api/errors/1f4a6307738da166. Report an issue: GitHub.