[issue11831] "python -w" causes "no Python documentation found" error when the path is not current directory

Susam Pal report at bugs.python.org
Tue Apr 12 02:46:54 CEST 2011


Susam Pal <susam at susam.in> added the comment:

Attached a one line fix that fixes this issue.

susam at nifty:~/pydoc-test$ pydoc -w ../pydoc-subject/
wrote calc.html
wrote calc.formulae.html
wrote config.html
wrote main.html
susam at nifty:~/pydoc-test$ ls
calc.formulae.html  calc.html  config.html  main.html

Diff:

--- /usr/lib/python2.7/pydoc.py.original	2011-04-12 04:56:19.000000000 +0530
+++ /usr/lib/python2.7/pydoc.py	2011-04-12 05:37:20.000000000 +0530
@@ -2299,6 +2299,7 @@
                 if ispath(arg) and os.path.isfile(arg):
                     arg = importfile(arg)
                 if writing:
+                    sys.path.insert(0, arg)
                     if ispath(arg) and os.path.isdir(arg):
                         writedocs(arg)
                     else:

----------
keywords: +patch
Added file: http://bugs.python.org/file21624/pydoc-27-syspath.diff

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue11831>
_______________________________________


More information about the Python-bugs-list mailing list