Remove Python UserWarning
You can change ~/.python-eggs
to not be writeable by group/everyone. I think this works:
chmod g-wx,o-wx ~/.python-eggs
You can suppress warnings using the -W ignore
:
python -W ignore yourscript.py
If you want to supress warnings in your script (quote from docs):
If you are using code that you know will raise a warning, such as a deprecated function, but do not want to see the warning, then it is possible to suppress the warning using the catch_warnings context manager:
import warnings
def fxn():
warnings.warn("deprecated", DeprecationWarning)
with warnings.catch_warnings():
warnings.simplefilter("ignore")
fxn()
While within the context manager all warnings will simply be ignored. This allows you to use known-deprecated code without having to see the warning while not suppressing the warning for other code that might not be aware of its use of deprecated code. Note: this can only be guaranteed in a single-threaded application. If two or more threads use the catch_warnings context manager at the same time, the behavior is undefined.
If you just want to flat out ignore warnings, you can use filterwarnings
:
import warnings
warnings.filterwarnings("ignore")