[Python-bugs-list] [ python-Bugs-410164 ] pydoc can't find module in current dir

noreply@sourceforge.net noreply@sourceforge.net
Wed, 28 Mar 2001 06:52:36 -0800


Bugs item #410164, was updated on 2001-03-20 13:42
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=410164&group_id=5470

Category: demos and tools
Group: Feature Request
Status: Closed
Priority: 5
Submitted By: Skip Montanaro (montanaro)
Assigned to: Ka-Ping Yee (ping)
Summary: pydoc can't find module in current dir

Initial Comment:
On my linux system pydoc doesn't seem able to find
modules in the current directory unless I set the
PYTHONPATH environment variable, including ".":

    % pydoc OO_Model
    No Python documentation found for 'OO_Model'.
    beluga:lib% PYTHONPATH=. pydoc OO_Model

    Python Library Documentation: module OO_Model
    ...

I examined the output of pydoc.pathdirs().  Even
without setting PYTHONPATH the directory containing the
OO_Model module is in the output (second directory):

    % python
    Python 2.1b1 (#1, Mar 12 2001, 16:13:37) 
    [GCC 2.95.3 19991030 (prerelease)] on linux2
    Type "copyright", "credits" or "license" for more
    information.
    >>> import pydoc
    >>> pydoc.pathdirs()
    ['/usr/local/lib/automatrix/python',
     '/home/skip/src/tttech/lib',
     '/usr/local/lib/python2.1',
     '/usr/local/lib/python2.1/plat-linux2',
     '/usr/local/lib/python2.1/lib-tk',
     '/usr/local/lib/python2.1/lib-dynload',
     '/usr/local/lib/python2.1/site-packages',
     '/home/skip/src/Zope/lib/python']

Seems like a bug to me.



----------------------------------------------------------------------

>Comment By: Fred L. Drake, Jr. (fdrake)
Date: 2001-03-28 06:52

Message:
Logged In: YES 
user_id=3066

I'd describe this as "Python does the right thing" -- pydoc is then overloading the semantics of sys.path.  It sounds like the internals of pydoc should receive a search path to use -- the startup code for pydoc can then compute that based on sys.path, removing it's own directory from it and adding anything more as appropriate.

----------------------------------------------------------------------

Comment By: Ka-Ping Yee (ping)
Date: 2001-03-26 15:37

Message:
Logged In: YES 
user_id=45338

Python itself is inconsistent in this regard (as Fred
rightly points out).  For now, the pydoc that made it
into 2.1b2 adds '.' to the path when run as a script;
in future it should probably also *remove* the script
directory from sys.path (when the script directory is
not the same as the current dir) for good consistency
with running python and importing pydoc interactively.

----------------------------------------------------------------------

Comment By: Fred L. Drake, Jr. (fdrake)
Date: 2001-03-20 22:00

Message:
Logged In: YES 
user_id=3066

This ia a pydoc issue; sys.path for a script includes the
script dir but not (necessarily) the current dir.

Assigned to Ping.

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=410164&group_id=5470