英文:
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 in 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.
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.
英文:
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.
-
Tried setting "env": {"PYDEVD_DISABLE_FILE_VALIDATION":"1"} in the launch.json file. Didn't change anything.
-
Tried setting "pythonArgs": ["-Xfrozen_modules=off"] in the launch.json file. Didn't change anything.
-
Tried setting warnings.filterwarnings('ignore', module='ExecutePreprocessor'). Didn't change anything.
-
Tried setting os.environ['PYTHONWARNINGS'] = ''. Didn't change anything.
-
Tried setting os.environ['PYDEVD_USE_CYTHON'] = '1'. Didn't change anything.
-
What I haven't tried is setting PYDEVD_DISABLE_FILE_VALIDATION=1. I don't know where to set this, how to set it, and the implications.
答案1
得分: 1
"Set PYDEVD_DISABLE_FILE_VALIDATION=1 to disable this validation" 可以翻译为:将PYDEVD_DISABLE_FILE_VALIDATION=1设置为禁用此验证。在1中添加名为'PYDEVD_DISABLE_FILE_VALIDATION'的用户或系统环境变量,并将值设置为'1'即可完成任务。
"Didn't know this is what it meant (newbie alert)." 可以翻译为:不知道这是什么意思(新手提醒)。
英文:
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).
答案2
得分: -1
请传递 -Xfrozen_modules=off 0.00s - 给python以禁用冻结模块。0.00s - 注意:调试将继续进行。设置PYDEVD_DISABLE_FILE_VALIDATION=1以禁用此验证。
英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论