question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

No stdout from jupyter.runStartupCommands

See original GitHub issue

Environment data

  • VS Code version: 1.60.0
  • Jupyter Extension version: v2021.8.2031190714
  • Python Extension version: v2021.9.1191016588
  • OS: Windows 10
  • Python and/or Anaconda version: python 3.6.6 64-bit
  • Type of virtual environment used: Winpython
  • Jupyter server running: N/A

Expected behaviour (usecase 1)

put “print(‘startup’)” into the jupyter.runStartupCommands section of settings.json -> ‘startup’ should appear in the interactive window on generation of interactive window or on kernel restart.

Actual behaviour (usecase 1)

no output visible

Expected behaviour (usecase 2)

run the following script via jupyter.runStartupCommands in settings.json:

import asyncio

loop = asyncio.get_event_loop()

async def myTask():
    for i in range(10):
        print(f'{i} hello')
        await asyncio.sleep(1)

loop.create_task(myTask())

Should print to the interactive window every second, as it happens if the script is manually executed.

Actual behaviour (usecase 2)

No output visible at first. After the first input to the interactive window is executed, output appears. So I assume that some initialization of the stdout needs to take place.

Notes

Might be related to #5379

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
IanMatthewHuffcommented, Sep 8, 2021

@lfriedri This was actually intentional on our side. The startup commands were intended to run silent at the start for any pre-configuration that was needed. However this might be work re-discussing. We’ll take about this at triage. Thanks for filing the issue.

0reactions
IanMatthewHuffcommented, Sep 9, 2021

Since your code is running async the output is just coming in on stdout from the python kernel. It only shows up when a cell exists in the UI to put the output into, which is why you see the behavior that you do. It’s a bit funky but I don’t think that it’s behavior that we will be changing now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do you suppress output in Jupyter running IPython?
stdout = open(os.devnull, 'w') both fail (end up printing an extra blank line). This should be the accepted answer. – Luke ...
Read more >
Jupyter Notebook stdout and stderr not showing up in the ...
Hi! I am using comet.ml on jupyter notebook to log my experiment results. # initialization cell from comet_ml import Experiment experiment ...
Read more >
Capturing Output With %%capture
IPython has a cell magic, %%capture , which captures the stdout/stderr of a cell. With this magic you ... This is a simple...
Read more >
Switching Data Analytics Activities From Jupyter to Vscode
I have been using VSCode almost for all activities related to software development. The last activity I preferred to do using an external ......
Read more >
JupyterLab no longer allows ouput to be redirected to stdout?
In the past when working in a Jupyter notebook, I could redirect output ... However, in a recent update of JupyterLab, this no...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found