The following is my code that causes this error: TypeError: argument of type 'HTML' is not iterable
from prompt_toolkit import prompt
from prompt_toolkit.formatted_text import FormattedText, HTML
def get_input():
prompt_text = [
("class:prompt-prefix", HTML('<ansired><b>{}</b></ansired>'.format('your input > '))),
("", '')
]
placeholder = HTML('<b>enter `q` or `exit` to exit </b>')
return prompt(prompt_text, placeholder=placeholder, default='').lower()
I tested and found that it is the prompt_text
that introduces errors and I changed it to this:
prompt_text = HTML('<ansired><b>{}</b></ansired>'.format('your input \> '))
# escape > character or not does not matter, I found
It still does not work. How to fix this bug?