Catching webbrowser error in RedHat

Skip Montanaro skip at pobox.com
Sun Mar 30 13:54:10 EST 2003


    Lance> I'm running Python 2.2 under RedHat8. I use webbrowser to open an
    Lance> html file in a browser window. This is my code:

    Lance>         try:
    Lance>             webbrowser.open(fname)
    Lance>         except:
    Lance>             print "ERROR: "+fname+" not found."

    Lance> 1. A Redhat "splash" screen shows for a few seconds prior to my
    Lance>    desired screen when try block is successful. Can this splash
    Lance>    screen be disabled?

Dunno.  Sounds like an issue with whatever browser you're using.  If you
want another browser to open, check the webbrowser module docs and set the
BROWSER environment variable accordingly.

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

Same-o, same-o.

Skip





More information about the Python-list mailing list