[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Make warning an exception?

On 12/6/19 12:58 PM, Israel Brewster wrote:
> I was running some code and I saw this pop up in the console:
> 2019-12-06 11:53:54.087 Python[85524:39651849] WARNING: nextEventMatchingMask should only be called from the Main Thread! This will throw an exception in the future.
> The only problem is, I have no idea what is generating that warning - I never call nextEventMatchingMask directly, so it must be getting called from one of the libraries I?m calling. Is there some way I can force python to throw an exception now, so my debugger can catch it and let me know where in my code the originating call is? I?ve tried stepping through the obvious options, with no luck so far.
> ---
> Israel Brewster
> Software Engineer
> Alaska Volcano Observatory
> Geophysical Institute - UAF
> 2156 Koyukuk Drive
> Fairbanks AK 99775-7320
> Work: 907-474-5172
> cell:  907-328-9145

You need to set the warning filter to "error", which you can do either with 
warnings.simplefilter at the start of your program or by setting the 
PYTHONWARNINGS environment variable.


This the same project you're having PySide/threading problems on?