Steps to reproduce: susam@nifty:~/pydoc-test$ tree ../pydoc-subject/ ../pydoc-subject/ |-- calc
-- formulae.py
`-- __init__.py
-- config.py
-- default.conf
-- main.py `-- spal.conf 1 directory, 6 files susam@nifty:~/pydoc-test$ pydoc -w ../pydoc-subject/ no Python documentation found for 'calc' no Python documentation found for 'config' no Python documentation found for 'main'
Attached a one line fix that fixes this issue. susam@nifty:~/pydoc-test$ pydoc -w ../pydoc-subject/ wrote calc.html wrote calc.formulae.html wrote config.html wrote main.html susam@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:
pydoc help: pydoc -w ... Write out the HTML documentation for a module to a file in the current directory. […] So there is no support for not using the current directory, probably on purpose in order to use the current-dir-in-sys.path trick, so I’m not sure if this should be addressed. (These days I would be more worried about src directories, which I’ve just tested are not handled well by pydoc, but that would be a different ticket.)
nosy: + ron_adam, eric.araujotitle: "python -w" causes "no Python documentation found" error when the path is not current directory -> "pydoc -w" causes "no Python documentation found" error when the path is not current directory