Skip to content

prompt-toolkit hanging #6504

Closed
Closed

Description

@anki-code

Hi! I'm trying to run prompt-toolkit (the main prompt engine for xonsh shell) and facing with hanging:

# rustpython v0.4.0 (https://github.com/RustPython/RustPython#ebdc033c)
rustpython -m pip install prompt-toolkit

ptk.py:

from prompt_toolkit import prompt
text = prompt("Say something: ")
print("You said:", text)

Run:

~/.cargo/bin/rustpython ptk.py
# Hanging

Activity

  1. coderabbitai commented on Dec 25, 2025

    @coderabbitai
    Contributor

    📝 CodeRabbit Plan Mode

    Generate an implementation plan and prompts that you can use with your favorite coding agent.

    • Create Plan
    Examples

    🔗 Similar Issues

    Related Issues

    👤 Suggested Assignees

    🧪 Issue enrichment is currently in open beta.

    You can configure auto-planning by selecting labels in the issue_enrichment configuration.

    To disable automatic issue enrichment, add the following to your .coderabbit.yaml:

    issue_enrichment:
      auto_enrich:
        enabled: false

    💬 Have feedback or questions? Drop into our discord!

  2. anki-code commented on Dec 25, 2025

    @anki-code
    Author

    I've found that starting from prompt-toolkit==3.0.44 ptk becomes hanging.

    ptk <=3.0.41 is working

    I've found that this version is working:

    rustpython -m pip install prompt-toolkit==3.0.41 

    ptk 3.0.42:

    rustpython -m pip install prompt-toolkit==3.0.42
    ~/.local/bin/rust-xonsh --no-rc --no-env
    Traceback (most recent call last):
      File "/Users/pc/.local/bin/rust-xonsh", line 3, in <module>
        from xonsh.main import main
      File "/Users/pc/.local/lib/rustpython3.13/site-packages/xonsh/main.py", line 12, in <module>
        import xonsh.procs.pipelines as xpp
      File "/Users/pc/.local/lib/rustpython3.13/site-packages/xonsh/procs/__init__.py", line 2, in <module>
        from xonsh.procs import proxies  # noqa
      File "/Users/pc/.local/lib/rustpython3.13/site-packages/xonsh/procs/proxies.py", line 21, in <module>
        import xonsh.tools as xt
      File "/Users/pc/.local/lib/rustpython3.13/site-packages/xonsh/tools.py", line 55, in <module>
        HAVE_CURSOR_SHAPE = False
      File "/Users/pc/.local/lib/rustpython3.13/site-packages/xonsh/tools.py", line 45, in <module>
        from prompt_toolkit.cursor_shapes import (
      File "/Users/pc/.local/lib/rustpython3.13/site-packages/prompt_toolkit/__init__.py", line 25, in <module>
        from .application import Application
      File "/Users/pc/.local/lib/rustpython3.13/site-packages/prompt_toolkit/application/__init__.py", line 3, in <module>
        from .application import Application
      File "/Users/pc/.local/lib/rustpython3.13/site-packages/prompt_toolkit/application/application.py", line 110, in <module>
        pythonapi.PyOS_getsig.restype = c_void_p
      File "/Users/pc/.cargo/git/checkouts/rustpython-63090cdce5e18442/ebdc033/crates/pylib/Lib/ctypes/__init__.py", line 412, in __getattr__
        func = self.__getitem__(name)
      File "/Users/pc/.cargo/git/checkouts/rustpython-63090cdce5e18442/ebdc033/crates/pylib/Lib/ctypes/__init__.py", line 417, in __getitem__
        func = self._FuncPtr((name_or_ordinal, self))
    AttributeError: dlsym failed

    ptk 3.0.43

    rustpython -m pip install prompt-toolkit==3.0.43
    ~/.local/bin/rust-xonsh --no-rc --no-env
    Traceback (most recent call last):
      File "/Users/pc/.local/lib/rustpython3.13/site-packages/xonsh/main.py", line 512, in main
        sys.exit(main_xonsh(args))
      File "/Users/pc/.local/lib/rustpython3.13/site-packages/xonsh/main.py", line 628, in main_xonsh
        postmain(args)
      File "/Users/pc/.local/lib/rustpython3.13/site-packages/xonsh/main.py", line 606, in main_xonsh
        exc_info = sys.exc_info()
      File "/Users/pc/.local/lib/rustpython3.13/site-packages/xonsh/main.py", line 559, in main_xonsh
        shell.shell.cmdloop()
      File "/Users/pc/.local/lib/rustpython3.13/site-packages/xonsh/main.py", line 559, in main_xonsh
        shell.shell.cmdloop()
      File "/Users/pc/.local/lib/rustpython3.13/site-packages/xonsh/shells/ptk_shell/__init__.py", line 436, in cmdloop
        break
      File "/Users/pc/.local/lib/rustpython3.13/site-packages/xonsh/shells/ptk_shell/__init__.py", line 410, in cmdloop
        line = self.singleline(auto_suggest=auto_suggest)
      File "/Users/pc/.local/lib/rustpython3.13/site-packages/xonsh/shells/ptk_shell/__init__.py", line 378, in singleline
        line = self.prompter.prompt(**prompt_args)
      File "/Users/pc/.local/lib/rustpython3.13/site-packages/prompt_toolkit/shortcuts/prompt.py", line 1030, in prompt
        inputhook=inputhook,
      File "/Users/pc/.local/lib/rustpython3.13/site-packages/prompt_toolkit/application/application.py", line 1002, in run
        return asyncio.run(coro)
      File "/Users/pc/.cargo/git/checkouts/rustpython-63090cdce5e18442/ebdc033/crates/pylib/Lib/asyncio/runners.py", line 193, in run
        with Runner(debug=debug, loop_factory=loop_factory) as runner:
      File "/Users/pc/.cargo/git/checkouts/rustpython-63090cdce5e18442/ebdc033/crates/pylib/Lib/asyncio/runners.py", line 194, in run
        return runner.run(main)
      File "/Users/pc/.cargo/git/checkouts/rustpython-63090cdce5e18442/ebdc033/crates/pylib/Lib/asyncio/runners.py", line 129, in run
        signal.signal(signal.SIGINT, signal.default_int_handler)
      File "/Users/pc/.cargo/git/checkouts/rustpython-63090cdce5e18442/ebdc033/crates/pylib/Lib/asyncio/runners.py", line 124, in run
        raise  # CancelledError
      File "/Users/pc/.cargo/git/checkouts/rustpython-63090cdce5e18442/ebdc033/crates/pylib/Lib/asyncio/runners.py", line 118, in run
        return self._loop.run_until_complete(task)
      File "/Users/pc/.cargo/git/checkouts/rustpython-63090cdce5e18442/ebdc033/crates/pylib/Lib/asyncio/base_events.py", line 687, in run_until_complete
        return future.result()
      File "/Users/pc/.cargo/git/checkouts/rustpython-63090cdce5e18442/ebdc033/crates/pylib/Lib/asyncio/futures.py", line 203, in result
        raise self._exception.with_traceback(self._exception_tb)
      File "/Users/pc/.cargo/git/checkouts/rustpython-63090cdce5e18442/ebdc033/crates/pylib/Lib/asyncio/tasks.py", line 314, in __step_run_and_handle_result
        result = coro.send(None)
      File "/Users/pc/.local/lib/rustpython3.13/site-packages/prompt_toolkit/application/application.py", line 865, in run_async
        with ExitStack() as stack:
      File "/Users/pc/.local/lib/rustpython3.13/site-packages/prompt_toolkit/application/application.py", line 877, in run_async
        stack.enter_context(set_handle_sigint(loop))
      File "/Users/pc/.cargo/git/checkouts/rustpython-63090cdce5e18442/ebdc033/crates/pylib/Lib/contextlib.py", line 530, in enter_context
        result = _enter(cm)
      File "/Users/pc/.cargo/git/checkouts/rustpython-63090cdce5e18442/ebdc033/crates/pylib/Lib/contextlib.py", line 143, in __enter__
        raise RuntimeError("generator didn't yield") from None
      File "/Users/pc/.cargo/git/checkouts/rustpython-63090cdce5e18442/ebdc033/crates/pylib/Lib/contextlib.py", line 141, in __enter__
        return next(self.gen)
      File "/Users/pc/.local/lib/rustpython3.13/site-packages/prompt_toolkit/application/application.py", line 810, in set_handle_sigint
        with _restore_sigint_from_ctypes():
      File "/Users/pc/.cargo/git/checkouts/rustpython-63090cdce5e18442/ebdc033/crates/pylib/Lib/contextlib.py", line 143, in __enter__
        raise RuntimeError("generator didn't yield") from None
      File "/Users/pc/.cargo/git/checkouts/rustpython-63090cdce5e18442/ebdc033/crates/pylib/Lib/contextlib.py", line 141, in __enter__
        return next(self.gen)
      File "/Users/pc/.local/lib/rustpython3.13/site-packages/prompt_toolkit/application/application.py", line 1608, in _restore_sigint_from_ctypes
        pythonapi.PyOS_getsig.restype = c_void_p
      File "/Users/pc/.cargo/git/checkouts/rustpython-63090cdce5e18442/ebdc033/crates/pylib/Lib/ctypes/__init__.py", line 412, in __getattr__
        func = self.__getitem__(name)
      File "/Users/pc/.cargo/git/checkouts/rustpython-63090cdce5e18442/ebdc033/crates/pylib/Lib/ctypes/__init__.py", line 417, in __getitem__
        func = self._FuncPtr((name_or_ordinal, self))
    AttributeError: dlsym failed

    ptk >= 3.0.44

    rustpython -m pip install prompt-toolkit==3.0.44
    ~/.local/bin/rust-xonsh --no-rc --no-env
    

    Hanging.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions