Catching webbrowser error in RedHat

Robin Munn rmunn at
Mon Mar 31 20:14:48 CEST 2003

Lance <lbrannma at> wrote:
> Hi All,
> I'm running Python 2.2 under RedHat8. I use webbrowser to open an html file
> in a browser window. This is my code:
>         try:
>         except:
>             print "ERROR: "+fname+" not found."
> 1. A Redhat "splash" screen shows for a few seconds prior to my desired
> screen when try block is successful. Can this splash screen be disabled?

Reading the API documentation for the webbrowser module
(, I don't
see any way within Python of setting options on the browser. You need to
consult the Red Hat documentation for this one -- this is not a Python

By the way, you really shouldn't be using a bare "except:" -- you'll
catch exceptions that you really didn't mean to catch. Use "except
webbrowser.Error:" instead.

> 2. If the try block is not successful, the Redhat splash screen shows,
> followed by an ugly system message box saying that the file could not be
> found. I want only the message in my except clause to display, not the
> system message.

Apparently your browser (which one is it? Netscape? Mozilla? Galeon?)
doesn't return an error code to the calling application on "URL not
found" conditions. Again, not something you can change within Python.
Check your system documentation.

Robin Munn <rmunn at>
PGP key ID: 0x6AFB6838    50FF 2478 CFFB 081A 8338  54F7 845D ACFD 6AFB 6838

More information about the Python-list mailing list