tmbo / questionary

Python library to build pretty command line user prompts ✨Easy to use multi-select lists, confirmations, free text prompts ...
MIT License
1.58k stars 93 forks source link

Add compatibility for Jupyter Notebooks #118

Open rojerian opened 3 years ago

rojerian commented 3 years ago

The following code …

import questionary
mol = questionary.text("What's the meaning of life").ask()

… in a jupyter notebook cell, when run, throws the error …

RuntimeError: This event loop is already running

Can questionary be used within a jupyter notebook at all and, if so, how best to configure ?

Thx

kiancross commented 3 years ago

This was asked a couple of days ago in #117 :) Unfortunately the answer is no, because prompt_toolkit doesn't support it: https://github.com/prompt-toolkit/python-prompt-toolkit/issues/1066.

tmbo commented 3 years ago

I'd agree though @rojerian if we could make this work transparently 🤔

kiancross commented 2 years ago

This could probably be done using ipywidgets, although may not be within the scope of questionary.

sdrap commented 2 years ago

I came across this error too and I see why it can not work. (Same for vscode interactive window). It's a shame because questionary is truly awesome in terminal and would be great to see it work in notebook or vscode.

clausagerskov commented 4 months ago

can we get a confirmation that this is indeed technically impossible and not just "wont-do"?