A Python library for building powerful interactive command-line applications. Current version: 3.0.52. Release cadence: Regular updates with new features and fixes.
pip install prompt_toolkitVerified import paths — ran on the pinned version, not inferred.
A simple example demonstrating the usage of the 'prompt' function from prompt_toolkit.
Update your code to remove imports from 'prompt_toolkit.shortcuts' and refactor accordingly.
Run your application in an interactive terminal environment (e.g., using `docker run -it` for Docker, or allocating a TTY in CI/CD setups). Alternatively, if interactive features are not required, consider using a non-interactive input method or a different library, or adjust your code to handle non-terminal input gracefully (e.g., by checking `sys.stdin.isatty()`).
Upgrade `prompt-toolkit` to the latest stable version and ensure all related packages (like `ipython`) are also up to date. You might need to uninstall and then reinstall `prompt-toolkit`. Example: `pip uninstall prompt-toolkit && pip install --upgrade prompt-toolkit` or `conda install -c conda-forge prompt_toolkit` if using Anaconda.
Rename your Python script file to something other than `prompt_toolkit.py` (e.g., `my_prompt_app.py`) to avoid conflicting with the library's package name.
Instead of passing `output` directly to `prompt()`, create a `PromptSession` instance with the desired output and then call its `prompt()` method.
```python
import sys
from prompt_toolkit import PromptSession
from prompt_toolkit.output import create_output
stderr_output = create_output(sys.stderr)
session = PromptSession(output=stderr_output)
text = session.prompt('Enter input: ')
```This often requires updating the dependent library that is trying to import `create_eventloop` to a version compatible with your `prompt-toolkit` installation, or updating `prompt-toolkit` itself. For `aws-shell`, previous solutions involved reinstalling or using specific `prompt-toolkit` versions.
Instead of calling `asyncio.run()` directly, you should integrate `prompt-toolkit`'s application into the existing event loop using its asynchronous API (e.g., `Application.run_async()`) or ensure that `prompt-toolkit` operations are performed within the main thread/event loop without nesting `asyncio.run()` calls. If running blocking code, consider using `run_in_executor` for better integration with asyncio.
No dependency data recorded yet.