RuntimeError?

Tim Peters tim_one at email.msn.com
Sun Jun 27 22:27:04 EDT 1999


[Gerrit Holl]
> can someone please give me an example when a RuntimeError is raised?
>
> I don't understand: if none of the others are raised.

Python 1.5.2 (#0, Apr 13 1999, 10:51:12) [MSC 32 bit (Intel)] on win32
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> import sys
>>> del sys.stdout
>>> print "hi"
Traceback (innermost last):
  File "<stdin>", line 1, in ?
RuntimeError: lost sys.stdout
>>>

Honestly, I had never seen a RuntimeError before!  I found this one by
digging thru the source code to see when it gets raised.  There's really no
pattern to it, and the RuntimeError docstring in Lib/exceptions.py
("Unspecified run-time error.") is as accurate as anything that says nothing
can be <wink>.  It generally seems to mean something bad and unexpected
happened, but not bad enough to shut down the interpreter (things *that* bad
raise SystemError).

more-art-than-science-here-ly y'rs  - tim






More information about the Python-list mailing list