Closed dimkauzh closed 1 year ago
If you want to hide the warning, all you need to do is suppress warnings when you import PySDL2:
import warnings
with warnings.catch_warnings():
warnings.simplefilter("ignore")
import sdl2
@a-hurst will it delete all pysdl2 warnings? or only this one?
@dimkauzh Only the one that occurs during import! Anything outside of the with warnings.catch_warnings()
context will raise errors/warnings like normal.
@dimkauzh Only the one that occurs during import! Anything outside of the
with warnings.catch_warnings()
context will raise errors/warnings like normal.
But if I get any weird error during import, will it be shown?
@dimkauzh If you hit any actual errors/exceptions during import, those will still get raised as usual. The code above only suppresses warnings (i.e. non-fatal messages). If there's an actual problem of some kind importing pysdl2, it'll still throw an exception.
throw
Okay thanks!
Hi, so I'm using pysdl2 and pysdl2-dll on mac and everytime I run my code I get this userwarning: