DepreciationWarnings triggered by openpyxl itself can't be suppressed

Issue #983 resolved
SB
created an issue

openpyxl\compat\__init__.py:depreciated() contains this at line 48:

warnings.simplefilter('always', DeprecationWarning)

This seems like a bad idea as it means there is no way to suppress DeprecationWarnings. The problem is that openpyxl itself raises DepreciationWarnings, which the user can't avoid:

...\openpyxl\worksheet\read_only.py:189: DeprecationWarning: Call to deprecated function get_squared_range (Use ws.iter_rows()).

then this means your stdout gets trashed without being able to do anything about it :-(. Overriding any filter added by client code doesn't seem like very good practice?

Comments (4)

  1. CharlieC

    Thanks for the report. As the source code makes clear, the decorator function was copied wholesale from another project. What kind of action do you suggest?

  2. SB reporter

    I’d simply remove the warnings.simplefilter('always', DeprecationWarning) line entirely - I think users/applications should be adding warnings filters, not a library.

  3. Log in to comment