#๐Ÿ”’ AM getting an error am not totally sure why

18 messages ยท Page 1 of 1 (latest)

hoary caveBOT
#

@sly perch

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

sly perch
#

what lol

#

i can't attach files nice

#

the error log is at the end

#

So here is some context
am very confused because am not using any asynic
the block that is causing the error is the keybinding 'n'

craggy anchor
#

prompt toolkit uses asyncio under the hood, particularly with the prompt() function. You're getting this error essentially because you're calling the bindings with prompt("", key_bindings=bindings), so when you call it again from within the n binding the error occurs.

you can swap out the prompt line within the 'n' binding with this and it should fix the issue.

        # Use prompt_toolkit's handler instead of prompt
        new_name = event.app.current_buffer.text  # Get current buffer text (user input)
        task_name = new_name.rstrip()  # Remove trailing newline
sly perch
#

it solved the rror

#

but when i hit enter it exit the program

#

lol

#

can i not call prompt with bindings at all ? @craggy anchor

#

Also i have a question mr Ryan is there a library like prompt-toolkit that is interactive cli not tui ?

#

task_name = prompt(">", in_thread=True)

#

did work too

#

I have a major issue with threading i didn't handle it properly

#

@craggy anchor thank you so much!

hoary caveBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.