I keep getting this :
DeprecationWarning: integer argument expected, got float
How do I make this message go away? Is there a way to avoid warnings in Python?
I keep getting this :
DeprecationWarning: integer argument expected, got float
How do I make this message go away? Is there a way to avoid warnings in Python?
You should just fix your code but just in case,
Convert the argument to int. It's as simple as
Pass the correct arguments? :P
On the more serious note, you can pass the argument -Wi::DeprecationWarning on the command line to the interpreter to ignore the deprecation warnings.
Not to beat you up about it but you are being warned that what you are doing will likely stop working when you next upgrade python. Convert to int and be done with it.
BTW. You can also write your own warnings handler. Just assign a function that does nothing. How to redirect python warnings to a custom stream?
When you want to ignore warnings only in functions you can do the following.
Just add the @ignore_warnings decorator on the function you want to ignore all warnings
I had these:
Fixed it with:
Now you still get all the other
DeprecationWarning
s, but not the ones caused by: