[issue11709] help-method crashes if sys.stdin is None
Palm Kevin
report at bugs.python.org
Tue Mar 29 11:26:04 CEST 2011
New submission from Palm Kevin <kevin.palm at labsolution.lu>:
The interactive help-method provided by python crashes when no stdin-stream is available (sys.stdin == None).
Exception:
Traceback (most recent call last):
File "MyScript", line 4, in <module>
File "C:\Python32\lib\site.py", line 457, in __call__
return pydoc.help(*args, **kwds)
File "C:\Python32\lib\pydoc.py", line 1748, in __call__
self.help(request)
File "C:\Python32\lib\pydoc.py", line 1795, in help
else: doc(request, 'Help on %s:', output=self._output)
File "C:\Python32\lib\pydoc.py", line 1537, in doc
pager(render_doc(thing, title, forceload))
File "C:\Python32\lib\pydoc.py", line 1345, in pager
pager = getpager()
File "C:\Python32\lib\pydoc.py", line 1352, in getpager
if not sys.stdin.isatty() or not sys.stdout.isatty():
AttributeError: 'NoneType' object has no attribute 'isatty'
I think that this situation should be handled:
- either by raising a clear error message indicating that help cannot be displayed because Python is executing in a non-interactive mode
- either by simply printing documentation to stdout (like this: "print(sys.__doc__)")
----------
messages: 132474
nosy: palm.kevin
priority: normal
severity: normal
status: open
title: help-method crashes if sys.stdin is None
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue11709>
_______________________________________
More information about the Python-bugs-list
mailing list