Annoying error popup

I try to use the wxMimeTypesManager, and it works for most suffixes, except for some for which the default icon cannot be loaded. I wrap the code in try ... except statements and check for invalid icon data and the exceptions are indeed thrown and properly catched, but there is still a "Python Error" dialog that pops up each time (XP/SP2):

"Python Error" - "Failed to load icon from file '%1' (error 2: System cannot find the specified file.)"

The same error occurs in the wxMimeTypesManager demo, but there it is silently logged to the background. How do I prevent the dialog from appearing? After all, my application successfully recovers from the error and falls back to a default icon.

Here's the code:

def getIconAndInfo(self, suffix):
        try:
            if suffix == "":
                raise
                           fileType = wx.TheMimeTypesManager.GetFileTypeFromExtension(suffix)
                    if fileType == None: raise
                      icon = fileType.GetIconInfo()[0]
            if not icon.Ok(): raise
                      return (icon, self.makeInfo(suffix))
               except: return (self.defaultIcon, self.makeInfo(self.defaultSuffix))

silently logged to the background. How do I prevent the dialog from
appearing? After all, my application successfully recovers from the
error and falls back to a default icon.

Hi,

The window is showing some error logging, try disabling logging early in your
program:

wx.Log_EnableLogging(False)

If this doesn't work try passing a False to your wx.App init. This will supress
redirecting stdout to a window:
   http://www.wxpython.org/docs/api/wx.App-class.html

Let me know if these don't work. in C++ wx you would set a null logging handler
but I'm hoping EnableLogging(False) does the same thing.

-Jim

this is IMHO the best approach for the developing phase as it will spill the errors in the console...
if you want silent logging to a file.... use
wx.App(1, errorLogFile)
(actually it will redirect all the output to that file... not only the errors but the stuff that gets in stdout too)

Peter.

···

On Sat, 17 Sep 2005 12:31:12 +0300, Jim Carroll <jim@maplesong.com> wrote:

silently logged to the background. How do I prevent the dialog from
appearing? After all, my application successfully recovers from the
error and falls back to a default icon.

Hi,

The window is showing some error logging, try disabling logging early in your
program:

wx.Log_EnableLogging(False)

If this doesn't work try passing a False to your wx.App init. This will supress
redirecting stdout to a window:
   http://www.wxpython.org/docs/api/wx.App-class.html