prompt-toolkit / prompt-toolkit/python-prompt-toolkit
assert app._is_running
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 10.6k
- Forks
- 815
- PR merge metrics
- No merged PRs in 30d
Description
i try to use this sequence of code but when i i execute session.prompt at the second time i have this error : assert app._is_running
is there a better sequence of coding ?
our_history = FileHistory('.example-history-file')
session = PromptSession(history=our_history)
batch = GBatch()
args = batch.parser.parse_args()
batch.init(args)
print ("Welcome ", batch.player)
args.func(args)
guru = True
while True:
with patch_stdout():
cmd = session.prompt(" >> ")
if cmd:
args = batch.parser.parse_args(cmd.split())
args.cmde = cmd
args.func(args)
if batch.bye:
break
here the trace
AssertionError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/bruno/gsprompt/venv/lib/python3.7/site-packages/prompt_toolkit/eventloop/base.py", line 129, in call_exception_handler
self._exception_handler(context)
File "/Users/bruno/gsprompt/venv/lib/python3.7/site-packages/prompt_toolkit/application/application.py", line 702, in handle_exception
run_coroutine_in_terminal(print_exception)
File "/Users/bruno/gsprompt/venv/lib/python3.7/site-packages/prompt_toolkit/application/run_in_terminal.py", line 62, in run_coroutine_in_terminal
assert app._is_running
AssertionError
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the supplied PromptSession sequence, including the second session.prompt call and patch_stdout context. Start by reading prompt_toolkit/eventloop/base.py, prompt_toolkit/application/application.py, and prompt_toolkit/application/run_in_terminal.py around the reported assertion. Done means the sequence no longer raises AssertionError, or the supported calling sequence and limitation are documented with a regression test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100