+4 votes
in Programming Languages by (73.8k points)
When I run my Python code, it shows many warning messages. I am not interested in those warning messages. How can I disable those messages?

1 Answer

+1 vote
by (349k points)
selected by
 
Best answer

You can disable the warning message by using "-W ignore" with python command. Here is an example.

$ python -W ignore your_program.py

-W arg
    Warning control. Python’s warning machinery by default prints warning messages to sys.stderr. A typical warning message has the following form:

       ignore
        Ignore all warnings.
 


...