Suppress Error Message from Python

I have a program that searches for a file icon based on the “mime type”.

For some of the mime types, the default icon location is filled with the value ‘%1’.

This results in a error box popping up with the title:

“Pythonw Error” with a “Details” button, which displays an error log.

NOTE this is not the small text box that I can re-direct “print” statements to.

I have tried to use “try/except” blocks, however, it doesn’t seem to make any difference. The errors seem to be coming from the OS.

In the demo, these messages are redirected to the massage log, so I know if can be done.

If anyone can provide a few tips on how to best prevent this message from popping up I would appreciate it.

TIA.

geoff.