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 fails with path specified
Type: Stage:
Components: Library (Lib) Versions: Python 2.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: ping Nosy List: doko, fdrake, ping, tim.peters
Priority: normal Keywords:

Created on 2002-07-26 10:31 by doko, last changed 2022-04-10 16:05 by admin. This issue is now closed.

Messages (5)
msg11714 - (view) Author: Matthias Klose (doko) * (Python committer) Date: 2002-07-26 10:31
[from http://bugs.debian.org/143462]

If I specify a path (ie, ./dictclient.py) and use -w, it will 
fail.  If -w
is not used, or a module (ie, dictclient) is specified, it 
will work. 
Example:

$ pydoc2.2 -w ./dictclient.py
Traceback (most recent call last):
  File "/usr/bin/pydoc2.2", line 4, in ?
    pydoc.cli()
  File "/usr/lib/python2.2/pydoc.py", line 2074, in cli
    writedoc(arg)
  File "/usr/lib/python2.2/pydoc.py", line 1345, in writedoc
    object = locate(key, forceload)
  File "/usr/lib/python2.2/pydoc.py", line 1297, in locate
    parts = split(path, '.')
  File "/usr/lib/python2.2/string.py", line 117, in split
    return s.split(sep, maxsplit)
AttributeError: 'module' object has no attribute 'split'
msg11715 - (view) Author: Fred Drake (fdrake) (Python committer) Date: 2002-08-07 15:28
Logged In: YES 
user_id=3066

Tim is friends with pydoc.  ;-)
msg11716 - (view) Author: Matthias Klose (doko) * (Python committer) Date: 2002-08-07 20:22
Logged In: YES 
user_id=60903

sorry for attaching the patch here (submitted on 
http://bugs.debian.org/143462)

[problem is found in 2.1, 2,2 and 2.3]

--- pydoc.py.old        Wed Aug  7 15:52:08 2002 
+++ pydoc.py    Wed Aug  7 15:51:10 2002 
@@ -1114,6 +1114,8 @@                
  
 def writedoc(key, forceload=0):                               
     """Write HTML documentation to a file in the current 
directory.""" 
+    if not isinstance(key, type('')):                      
+        key = key.__name__ 
     try: 
         object = locate(key, forceload) 
     except ErrorDuringImport, value: 
msg11717 - (view) Author: Tim Peters (tim.peters) * (Python committer) Date: 2002-08-09 01:17
Logged In: YES 
user_id=31435

Ping, if you're there, would you please take a look at this?  I 
didn't even know pydoc had a -w argument <0.9 wink> ...
msg11718 - (view) Author: Ka-Ping Yee (ping) * (Python committer) Date: 2002-08-11 15:13
Logged In: YES 
user_id=45338

I have tested and checked in a fix that addresses this problem; it also 
factors out the code for resolving names, so it's not duplicated in doc() and 
writedoc() anymore.
History
Date User Action Args
2022-04-10 16:05:31adminsetgithub: 36933
2002-07-26 10:31:12dokocreate