This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: pydoc doesn't work from the command line
Type: crash Stage: needs patch
Components: Library (Lib) Versions: Python 3.1, Python 3.2
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: ncoghlan Nosy List: eric.araujo, ncoghlan, pitrou
Priority: normal Keywords:

Created on 2009-11-15 14:34 by pitrou, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (4)
msg95297 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2009-11-15 14:34
This works under 2.x but not 3.x:

$ ./python -m pydoc str
No module named subprocess
msg95298 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2009-11-15 14:42
Same with an installed Python by the way:

$ usr/bin/python3 -m pydoc str
No module named subprocess

However, it works when not using "-m" but invoking the file directly:

$ ./python Lib/pydoc.py str

[displays the str doc page]
msg95313 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2009-11-15 22:27
pydoc removes the "scriptdir" from sys.path. When run under -m, that
means it removes the standard library directory!

It works in 2.x because os.popen doesn't rely on subprocess there -
instead it comes direct from the builtin posix module.
msg95314 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2009-11-15 22:38
Fixed in r76312 and subsequent checkins (pydoc was corrupting sys.path
when run under -m and getting away with it in 2.x, but breaking os.popen
in 3.x)
History
Date User Action Args
2022-04-11 14:56:54adminsetgithub: 51577
2010-01-31 16:04:16eric.araujosetnosy: + eric.araujo
2010-01-31 15:59:44georg.brandllinkissue7749 superseder
2009-11-15 22:38:49ncoghlansetstatus: open -> closed
resolution: fixed
2009-11-15 22:38:36ncoghlansetmessages: + msg95314
2009-11-15 22:27:40ncoghlansetmessages: + msg95313
2009-11-15 14:42:32pitrousetassignee: ncoghlan

messages: + msg95298
nosy: + ncoghlan
2009-11-15 14:34:38pitroucreate