1

Google Colab allows you to enter values into an output cell, during runtime.

Can I enter in user input, when calling a program via. the shell?

Can JupyterLab handle stdin from the shell?

Example:

Cell: !tensorboard dev upload --logdir tb_logs --name "OntologyTagger" --description "OntologyTagger" --one_shot

Output: Continue? (yes/NO), I click a text field and enter text. enter image description here


How can I do this in JupyterLab?

JupyterLab: enter image description here

  • 1
    This question was answered in https://github.com/jupyterlab/jupyterlab/issues/10881#issuecomment-903005097, which highlights that a solution would need to be implemented in the kernel itself, and that there is an open issue discussing it in https://github.com/ipython/ipykernel/issues/513. It looks like a godd first issue to me if anyone would like to contribute. – krassowski Aug 21 '21 at 14:23

1 Answers1

0

This functionality is provided using input method of python. So whenever you wanted to wait till user provide some kind of input during execution of the program use input method.

name = input('Provide your name\n')

When we run this code inside jupyter lab or jupyter notebook cell it will wait till we provide input into it.

Keep note Whatever data we pass it's datatype is string so if you are taking numerically data as input make sure to type cast it.

Swapnil Pote
  • 136
  • 7
  • Hey thanks for posting an answer. What cells do I place this into? When, during the runtime? What variable name do I give it? I assume it would be `my_input = input('yes\n')`. –  Aug 20 '21 at 13:24
  • 1
    You can use put into any cell in which you want to take input during runtime. Variable name is totally up to you no restriction on it. – Swapnil Pote Aug 20 '21 at 13:28
  • new cell: `in_continue = input('yes\n')` is stuck on `[*]`. It is right above cell that requires input. –  Aug 20 '21 at 13:36
  • Upon research; string param for `input()` is a prompt to the user.. not a means of entering in a value to a cell (in the sense that I'm after). I hope my post makes sense. –  Aug 20 '21 at 13:38
  • 1
    I was in assumption that you want hold current cell execution in between then take input from user and based on that input execute next step on same cell. – Swapnil Pote Aug 20 '21 at 13:58
  • Sorry, I accidentally edited your answer. Please ignore. –  Aug 20 '21 at 13:59
  • Updated post title is the best way I can describe this feature, that I'm having problems with. –  Aug 20 '21 at 14:00
  • I learnt the technical jargon! I've updated my post asking better questions. –  Aug 20 '21 at 15:30