Vscode-jupyter: Warnings are not shown in the Notebook editor

Created on 24 May 2020  路  3Comments  路  Source: microsoft/vscode-jupyter

Bug: Notebook Editor, Interactive Window, Editor cells


Warnings are not shown in the Notebook Editor.

Steps to cause the bug to occur

  1. If I run the following code in a .py from terminal, I get the warning message, but if I run it inside a cell in the Notebook editor, nothing appears.

import warnings  
warnings.warn('Warning Message') 

Actual behavior

Expected behavior

Your Jupyter and/or Python environment

_Please provide as much info as you readily know_

  • Jupyter server running: Local
  • Extension version: 2020.5.80290
  • VS Code version: 1.45.1
  • Setting python.jediEnabled: false
  • **Python version: Python 3.8.0
  • OS: Windows | Mac | Linux (distro): Linux (Ubuntu)
  • Virtual environment: conda | venv | virtualenv | N/A | ... venv

Developer Tools Console Output

Microsoft Data Science for VS Code Engineering Team: @rchiodo, @IanMatthewHuff, @DavidKutu, @DonJayamanne, @greazer

bug

Most helpful comment

@IanMatthewHuff thanks. Yes, please do. Data-science packages often provide important warnings.
For anyone else who might face the same problem, you'll need to use warnings.simplefilter(action="default") in the notebooks for now.

All 3 comments

@ashtou Thanks for reporting this, and sorry about the issue. I took a peek and I repro the same thing. A warning is shown in a jupyter notebook, but not in our notebook editor view. We'll triage this issue.

@IanMatthewHuff thanks. Yes, please do. Data-science packages often provide important warnings.
For anyone else who might face the same problem, you'll need to use warnings.simplefilter(action="default") in the notebooks for now.

You can automatically do this for every notebook or interactive window by adding the following to settings.json

    "python.dataScience.runStartupCommands": 
        ["import warnings", 
        "warnings.simplefilter(action='default')"
    ]
Was this page helpful?
0 / 5 - 0 ratings