nteract/papermill

nbclient.exceptions.DeadKernelError if Python Warnings Filter set to 'default'

開放

#660 建立於 2022年4月6日

 (0 則留言) (2 個反應) (0 位負責人)Python (402 個分叉)batch import
bughelp wanted

倉庫指標

星標
 (5,381 顆星)
PR 合併指標
 (PR 指標待抓取)

描述

Question

:wave: Hi. While trying to get a nightly notebook pytest test working again with modern papermill and scrapbook (c.f. https://github.com/scikit-hep/pyhf/pull/1841) I noticed that if I have Python filter warnings set to 'default', I can get a nbclient.exceptions.DeadKernelError from papermill if the notebook being executed has any IPython/Jupyter magics like shell evaluation with !.

Example from https://github.com/scikit-hep/pyhf/pull/1841:

    - name: Test example notebooks
      shell: bash
      run: |
        # Override the ini option for filterwarnings with an empty list to disable error
        # on filterwarnings as testing for notebooks to run with the latest API, not if
        # Jupyter infrastructure is warning free.
        # Though still show warnings by setting warning control to 'default'.
        export PYTHONWARNINGS='default'
        pytest --override-ini filterwarnings= tests/test_notebooks.py

Do you have any ideas why setting PYTHONWARNINGS='default' which will

print the first occurrence of matching warnings for each location (module + line number) where the warning is issued

would cause a nbclient.exceptions.DeadKernelError, which goes away if PYTHONWARNINGS is not set?

Log files

There is a log file for

$ PYTHONWARNINGS='default' pytest --override-ini filterwarnings= tests/test_notebooks.py -k test_xml_importexport &> /tmp/pythonwarnings_log.txt

at https://github.com/scikit-hep/pyhf/issues/1840#issuecomment-1089982787, which I can link here: https://github.com/scikit-hep/pyhf/files/8425002/pythonwarnings_log.txt

Related Issues and PRs

貢獻者指南