You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Does this issue occur when all extensions are disabled?: Not sure (need extensions to use Jupyter)
VS Code Version: 1.78.2
OS Version: Windows 11 Enterprise 22H2
Using Jupyter Notebooks in VS Code
Launching VS Code from WSL2 Ubuntu 18.04 terminal
Connecting Jupyter Notebook with conda environment (although issue seems to repro without conda)
Jupyter extension v2023.4.10112418018
Steps to Reproduce:
Open VS code from WSL2 with code . (where conda environments are already initialized)
Create a new Jupyter Notebook in VS Code
Connect the Jupyter Notebook to a conda environment as the python kernel (select Kernel >> Python Environments >> conda environment)
Populate the first python cell of the jupyter notebook with the following code:
# Prompt the user 10 times (0-9 times) and ask them to enter the answer number# this will then print the question number and answer number togetherforquestion_numinrange(0, 10):
answer_num=input("Enter the Answer Number:")
print(f"Question Num = #{question_num}; Answer Num = #{answer_num}")
Execute the cell and enter your answers as 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 (one at a time). Note that the answer numbers always remain in sync with the question numbers, but the bug shows up when the question-answer pairs aren't always being displayed to the console after providing the answer number. For example:
Here I'm about to enter 3 as an answer after having entered "0", "1", and "2"; Only "0" and "1" have flushed:
Here I just entered 3 and am about to enter 4 and all 4 previous response ("0", "1", "2", "3") have flushed:
Note that this issue doesn't occur on IDEs such as JupyterLab and Jupyter Notebooks, only on VS Code Jupyter Notebooks.
Solution/Workaround:
The solution/workaround was to add a sys.stdout.flush() before prompting the next time around, as shown below:
It would be good however for VS Code to not do this buffering, especially since JupyterLab and Jupyter Notebook don't run into this issue.
The text was updated successfully, but these errors were encountered:
Does this issue occur when all extensions are disabled?: Not sure (need extensions to use Jupyter)
Steps to Reproduce:
code .
(where conda environments are already initialized)Here I'm about to enter 3 as an answer after having entered "0", "1", and "2"; Only "0" and "1" have flushed:
Here I just entered 3 and am about to enter 4 and all 4 previous response ("0", "1", "2", "3") have flushed:
Note that this issue doesn't occur on IDEs such as JupyterLab and Jupyter Notebooks, only on VS Code Jupyter Notebooks.
Solution/Workaround:
The solution/workaround was to add a
sys.stdout.flush()
before prompting the next time around, as shown below:It would be good however for VS Code to not do this buffering, especially since JupyterLab and Jupyter Notebook don't run into this issue.
The text was updated successfully, but these errors were encountered: