Even when switching to mstrio.project_objects.dashboard
it still shows deprecation warning and ignoring it doesn't work
$ pip install -Uq mstrio-py
$ export PYTHONWARNINGS='ignore:mstrio.project_objects.dossier module is deprecated:DeprecationWarning'
$ python3 -c 'from mstrio.project_objects import dashboard'
DeprecationWarning: mstrio.project_objects.dossier module is deprecated and will not be supported starting from mstrio-py 11.5.03. Please use mstrio.project_objects.dashboard instead.
$ python3 -W "ignore:mstrio.project_objects.dossier module is deprecated:DeprecationWarning" -c "from mstrio.project_objects import dashboard"
DeprecationWarning: mstrio.project_objects.dossier module is deprecated and will not be supported starting from mstrio-py 11.5.03. Please use mstrio.project_objects.dashboard instead.
Guarding the import using a context manager doesn't work either
>>> import warnings
>>> with warnings.catch_warnings():
... warnings.filterwarnings("ignore", message=".*mstrio.project_objects.dossier module is deprecated.*")
... from mstrio.project_objects import dashboard
...
DeprecationWarning: mstrio.project_objects.dossier module is deprecated and will not be supported starting from mstrio-py 11.5.03. Please use mstrio.project_objects.dashboard instead.
Why doesn't it go away? How to avoid this deprecation warning?
This is latest mstrio-py i.e. 11.4.3.101.
mstrio
overrides your warning filter:
warnings.filterwarnings(action=print_warnings, module=module_path)
warnings.filterwarnings(
action=print_warnings, category=DeprecationWarning, module=module_path
)
warnings.filterwarnings(action='default', category=UserWarning, module=module_path)
It also monkey-patches the warning formatter, which is why your warning message doesn't look like it normally would:
def custom_formatwarning(msg, category, *args, **kwargs):
# ignore everything except the message
return str(category.__name__) + ': ' + str(msg) + '\n'
warnings.formatwarning = custom_formatwarning
There's a lot of stuff in that file that this package really shouldn't be doing. Your best option may be to raise an issue with MicroStrategy and ask them to change this.