[Tutor] sys._doc_ documentation

Mark Hadfield m.hadfield@niwa.cri.nz
Fri, 8 Jun 2001 12:28:39 +1200


From: "F. Tourigny" <j_f9@yahoo.com>


> I'm just starting with Programming Python, p. 16.
> Typing:
>    sys._doc_
> at the python prompt returns this message:
>
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
> AttributeError: 'sys' module has no attribute '_doc_'
>
> However, "dir(sys)" is listing "_doc_" among the
> module's attributes.
> What gives?
> (Using ActivePython 2.1, Build 210)

Works for me (below). You probably left off one of the underscores.

ActivePython 2.1, build 210 ActiveState)
based on Python 2.1 (#15, Apr 19 2001, 10:28:27) [MSC 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.>>>
import sys
>>> import sys
>>> sys.__doc__
"This module provides access to some objects used or maintained by
the\ninterpre
ter and to functions that interact strongly with the interpreter.\n\nDynamic
obj
ects:\n\nargv -- command line arguments; argv[0] is the script pathname if
known
\npath -- module search path; path[0] is the script directory, else
''\nmodules
-- dictionary of loaded modules\n\ndisplayhook -- called to show results in
an i
nteractive session\nexcepthook -- called to handle any uncaught exception
other
than SystemExit\n  To customize printing in an interactive session or to
install
 a custom\n  top-level exception handler, assign other functions to replace
thes
e.\n\nexitfunc -- if sys.exitfunc exists, this routine is called when Python
exi
ts\n  Assigning to sys.exitfunc is deprecated; use the atexit module
instead.\n\
....

---
Mark Hadfield
m.hadfield@niwa.cri.nz  http://katipo.niwa.cri.nz/~hadfield
National Institute for Water and Atmospheric Research