Errors and their messages
Hans Nowak
wurmy at earthlink.net
Sun Dec 2 01:41:27 EST 2001
seb wrote:
> Hi all,
>
> i think i've only ever followed up here before, but here goes:
>
> The python error messages presented on the command line seem to me to
> be particularly gregious.
>
> Say someone is looking to get schoolkids to be involved in programming
> (and python seems to be a reasonable choice here so i understand),
> then something like:
>
> Traceback (innermost last):
> File "<stdin>", line 1, in ?
> File "win32com\client\__init__.py", line 13, in Dispatch
> dispatch, userName =
> dynamic._GetGoodDispatchAndUserName(dispatch,userName,c
> lsctx)
> File "win32com\client\dynamic.py", line 67, in
> _GetGoodDispatchAndUserName
> return (_GetGoodDispatch(IDispatch, clsctx), userName)
> File "win32com\client\dynamic.py", line 58, in _GetGoodDispatch
> IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx,
> pythoncom.II
> D_IDispatch)
>
> doesn't make it easy.
>
> OK, i might be trying to do a bit more here, but even
>
> >>> lala
> Traceback (innermost last):
> File "<stdin>", line 1, in ?
> NameError: lala
> >>>
>
> is cryptic.
It's not so cryptic anymore if you read the fine tutorial:
http://www.python.org/doc/current/tut/node10.html
Error messages consist of a traceback, that tells you in what code
the exception occured, plus the exception being raised (type and
a message, e.g. NameError and "lala", in your example above).
Tracebacks are often nested, and can therefore look impressive;
they're not that difficult to figure out though.
--Hans
More information about the Python-list
mailing list