accessing detail about Exceptions

Bill Seitz fluxent at yahoo.com
Tue Apr 24 12:30:48 EDT 2001


"Steve Purcell" <stephen_purcell at yahoo.com> wrote in message
news:mailman.988094016.14138.python-list at python.org...
> Bill Seitz wrote:
> > I'm pretty new to Python, but my books are pre-v2. Is there any good
example
> > code anywhere for catching exceptions? I'm particularly interested in
> > accessing the "associated value" info, without having trapped a
particular
> > type of exception (in other words, I want to catch with a generic
"except:"
> > if possible, not "except ValueError:"...)
>
> Look at 'exc_info()' in the 'sys' module:
>
>    try:
>        something_or_other()
>    except:
>        exc_type, exc_value, traceback = sys.exc_info()
>
> The exception value you want is 'exc_value' in this case.
>
> -Steve

Thanks. Confirmed that's it's a basic opening-connection problem
([Microsoft][ODBC SQL Server Driver]Client unable to establish connection in
LOGIN). Now I just have to figure out why that's happening for the ASP page
and not the interactive session. Probably some stupid nasty sysadmin
problem. Gads I hate those...






More information about the Python-list mailing list