[wxPython-users] Suppress Error Message from Python

Peter Damoc pdamoc at gmail.com
Wed Sep 5 11:44:48 PDT 2007


Use the Source Luke, use the Source!

The following is from the _core.py
I hope it helps.

    def __init__(self, redirect=3D_defRedirect, filename=3DNone,
                 useBestVisual=3DFalse, clearSigInt=3DTrue):
        """
        Construct a ``wx.App`` object.

        :param redirect: Should ``sys.stdout`` and ``sys.stderr`` be
            redirected?  Defaults to True on Windows and Mac, False
            otherwise.  If `filename` is None then output will be
            redirected to a window that pops up as needed.  (You can
            control what kind of window is created for the output by
            resetting the class variable ``outputWindowClass`` to a
            class of your choosing.)

        :param filename: The name of a file to redirect output to, if
            redirect is True.

        :param useBestVisual: Should the app try to use the best
            available visual provided by the system (only relevant on
            systems that have more than one visual.)  This parameter
            must be used instead of calling `SetUseBestVisual` later
            on because it must be set before the underlying GUI
            toolkit is initialized.

        :param clearSigInt: Should SIGINT be cleared?  This allows the
            app to terminate upon a Ctrl-C in the console like other
            GUI apps will.

On 9/5/07, Geoff Skerrett <Geoff at teammsa.com> wrote:
>
>  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.
>
>



-- =

There is NO FATE, we are the creators.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wxwidgets.org/pipermail/wxpython-users/attachments/200709=
05/0c9c0576/attachment.htm


More information about the wxpython-users mailing list