mne-tools / mne-python

MNE: Magnetoencephalography (MEG) and Electroencephalography (EEG) in Python
https://mne.tools
BSD 3-Clause "New" or "Revised" License
2.62k stars 1.3k forks source link

Report.save() ignores `verbose` parameter value #12152

Closed hoechenberger closed 9 months ago

hoechenberger commented 9 months ago

Description of the problem

Saving a report and setting verbose=False, verbose="warning", or verbose="error" still prints out log message of level info.

Steps to reproduce

import mne

r = mne.Report()
r.save("/tmp/foo.html", overwrite=True, open_browser=False, verbose="error")

Link to data

No response

Expected results

No output

Actual results

Embedding : jquery-3.6.0.min.js
Embedding : bootstrap.bundle.min.js
Embedding : bootstrap.min.css
Embedding : bootstrap-table/bootstrap-table.min.js
Embedding : bootstrap-table/bootstrap-table.min.css
Embedding : bootstrap-table/bootstrap-table-copy-rows.min.js
Embedding : bootstrap-table/bootstrap-table-export.min.js
Embedding : bootstrap-table/tableExport.min.js
Embedding : bootstrap-icons/bootstrap-icons.mne.min.css
Embedding : highlightjs/highlight.min.js
Embedding : highlightjs/atom-one-dark-reasonable.min.css

Additional information

larsoner commented 9 months ago

I think this is a usage error, you need verbose=False in the constructor as that's when the embedding happens:

>>> r = mne.Report()
Embedding : jquery-3.6.0.min.js
Embedding : bootstrap.bundle.min.js
Embedding : bootstrap.min.css
Embedding : bootstrap-table/bootstrap-table.min.js
Embedding : bootstrap-table/bootstrap-table.min.css
Embedding : bootstrap-table/bootstrap-table-copy-rows.min.js
Embedding : bootstrap-table/bootstrap-table-export.min.js
Embedding : bootstrap-table/tableExport.min.js
Embedding : bootstrap-icons/bootstrap-icons.mne.min.css
Embedding : highlightjs/highlight.min.js
Embedding : highlightjs/atom-one-dark-reasonable.min.css
>>> r = mne.Report(verbose=False)
>>>
hoechenberger commented 9 months ago

But Report.save() does have a verbose parameter, why can I not control things via that parameter directly? If it doesn't have any effect, we should remove it…

hoechenberger commented 9 months ago

Oh. Now I see what you mean! The output is not generated during saving, but when the Report is being instantiated! Got it!!