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 -w" causes "no Python documentation found" error when the path is not current directory
Type: behavior Stage:
Components: Library (Lib) Versions: Python 3.11, Python 3.10, Python 3.9
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: eric.araujo, iritkatriel, ron_adam, susam
Priority: normal Keywords: patch

Created on 2011-04-12 00:42 by susam, last changed 2022-04-11 14:57 by admin.

Files
File name Uploaded Description Edit
pydoc-27-syspath.diff susam, 2011-04-12 00:46 One line fix for "no Python documentation found" error.
Messages (4)
msg133557 - (view) Author: Susam Pal (susam) Date: 2011-04-12 00:42
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'
msg133558 - (view) Author: Susam Pal (susam) Date: 2011-04-12 00:46
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:
msg379327 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2020-10-22 19:39
pydoc help:

  pydoc -w <name> ...
    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.)
msg411595 - (view) Author: Irit Katriel (iritkatriel) * (Python committer) Date: 2022-01-25 14:30
Closed Issue31305 as a duplicate of this.
History
Date User Action Args
2022-04-11 14:57:16adminsetgithub: 56040
2022-01-25 14:30:12iritkatrielsetnosy: + iritkatriel

messages: + msg411595
versions: + Python 3.9, Python 3.10, Python 3.11, - Python 2.7, Python 3.2
2022-01-25 14:29:52iritkatriellinkissue31305 superseder
2020-10-22 19:39:36eric.araujosetmessages: + msg379327
2011-04-15 17:00:16eric.araujosetnosy: + ron_adam, eric.araujo

title: "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
2011-04-12 00:46:53susamsetfiles: + pydoc-27-syspath.diff
keywords: + patch
messages: + msg133558
2011-04-12 00:42:44susamcreate