Skip to content

CFData Assertion Failure on macOS 15 (Apple Silicon) with Live Screen Translator #1

@ylluminate

Description

@ylluminate

First, I want to thank you for this amazing tool. This could resolve a lot of headaches and improve convenience tremendously.

When running the Live Screen Translator on macOS 15 (Sequoia) with Python 3.13, the application crashes with the following error:

Assertion failed: (range.location <= dataLength), function __CFDataValidateRange, file CFData.c, line 219.

Steps to Reproduce:

  1. Clone the repository.
  2. Install prerequisites:
    • Python 3.8+ (tested with Python 3.13)
    • Tesseract OCR (installed via Homebrew)
    • Other dependencies (via pip install -r requirements.txt)
  3. Update settings.json to use the macOS Tesseract path (e.g., /opt/homebrew/bin/tesseract):
    {
        "tesseract_path": "/opt/homebrew/bin/tesseract",
        "default_source_lang": "pt",
        "default_target_lang": "en",
        "save_debug_images": false,
        "overlay_opacity": 0.8,
        "overlay_position": {"x": 100, "y": 100},
        "version": "1.0.2"
    }
  4. Run the application using:
    python run.py
  5. The application immediately crashes with the CFData assertion error.

Observations:

  • I made a screenshot capture test (using test_capture.py (code below)) works correctly, so mss is functioning.
  • Disabling the hotkey manager (by commenting out its initialization in src/main.py) did not prevent the crash.
  • Modifying the OCR function to force the image into RGB mode or even saving to a temporary file for pytesseract did not resolve the issue.
  • This appears to be a low-level crash in macOS’s CoreFoundation (likely when handling image data passed to pytesseract).
  • The environment details are:
    • macOS: 15 Sequoia (Apple Silicon)
    • Python: 3.13.2 (attempts to use Python 3.12 were also made but the issue persisted)
    • Tesseract OCR: Version 5.5.0 (via Homebrew)
    • mss: 10.0.0
    • Pillow: 11.1.0
    • pytesseract: 0.3.13

Expected Behavior:
The application should start and run without triggering a CFData assertion failure, allowing the OCR and overlay functionality to work as intended.

Actual Behavior:
The application crashes immediately with the following error:

Assertion failed: (range.location <= dataLength), function __CFDataValidateRange, file CFData.c, line 219.

Request:
Could you please investigate whether this issue is related to compatibility problems with macOS 15 (or with Python 3.13 on macOS) and provide guidance or a fix? Any help or workaround would be greatly appreciated.

If you can't, I'd be happy to do whatever you need, test and return with reports, etc.

Thank you for your time and assistance!


Source for test_capture.py mentioned above, which executes fine:

import mss

with mss.mss() as sct:
    filename = sct.shot(output='test.png')
    print(f"Screenshot saved as {filename}")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions