pythonjupyter-notebooknbconvert

How to disable debugger warnings about frozen modules when using nbconvert.ExecutePreprocessor in python script?


I am trying to run a python script to run all cells in all notebooks found a directory. It runs fine and I am getting the desired results in the notebook files. However, I want to disable the warnings that are printed to the VSCode cmd terminal when running the script. My code below:

import nbformat
from glob import glob
from nbconvert.preprocessors import ExecutePreprocessor

if __name__ == "__main__":

    nb_list = glob("./*.ipynb")

    ep = ExecutePreprocessor()

    for nb in nb_list:
        with open(nb) as f:
            nb_r = nbformat.read(f, as_version=4)
            ep.preprocess(nb_r)

The console output:

0.00s - Debugger warning: It seems that frozen modules are being used, which may 0.00s - make the debugger miss breakpoints. Please pass -Xfrozen_modules=off 0.00s - to python to disable frozen modules. 0.00s - Note: Debugging will proceed. Set PYDEVD_DISABLE_FILE_VALIDATION=1 to disable this validation.


Solution

  • Figured out how to "Set PYDEVD_DISABLE_FILE_VALIDATION=1 to disable this validation". Adding a user or system environment variable called 'PYDEVD_DISABLE_FILE_VALIDATION' and setting the value to '1' did the job.

    Didn't know this is what it meant (newbie alert).