Skip to content

import keyboard crashes on macOS in examples/re_book/1_brain_evolution.py #88

Description

@JedMuff

import keyboard crashes on macOS in examples/re_book/1_brain_evolution.py

Running the example in the main branch aborts immediately with:

Assertion failed: (range.location + range.length <= dataLength), function __CFDataValidateRange, file CFData.c, line 235.
(exit code 134, SIGABRT — no Python traceback)

Reproduction: uv run python -c "import keyboard" — crashes on its own, independent of the example.

Environment:

  • macOS 13.6.7 (Darwin 22.6.0), arm64 (Apple Silicon)
  • Python 3.12.9
  • keyboard 0.13.5 (pulled in via ariel's deps)

Notes:

  • keyboard is imported as kb at examples/re_book/1_brain_evolution.py:20 but never actually used in that file — a simple fix is to drop the import.
  • More broadly, the keyboard package is a bad cross-platform dep: it's effectively unmaintained, needs root on macOS/Linux to work, and has open issues about this exact CoreFoundation assertion. Consider replacing it with pynput or removing it from ariel's dependencies if it's only used in examples.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions