I'm using django's dumpdata and loaddata commands to facilitate some data exports. However I currently have some unresolved deprecation warnings and so when I write the output of dumpdata to a file the warnings end up at the top of the file and I must manually clean up the dump files every time. Is there any way to suppress or avoid the warnings do that the output of dumpdata is legitimate json without having to manually remove the warning text each time?
you can also suppress warnings without having to insert code anywhere, by flags on the python interpreter
eg
python -Wi manage.py dumpdata
https://docs.python.org/2/using/cmdline.html#cmdoption-W
You could try overriding warning.showwarning
. Put the following code somewhere that will be imported when you dumpdata
(such as your settings.py
):
import warnings
warnings.showwarning = lambda *x: None
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With