pydoc script.py vs. pydoc scriptpy
stargaming at gmail.com
Mon Oct 22 17:21:45 CEST 2007
On Sat, 20 Oct 2007 15:02:26 +0000, BartlebyScrivener wrote:
> On Debian Etch, if ~/mypyscripts is in my bash PATH and also in
> PYTHONPATH, I get the following pydoc behaviors. Maybe this is
> intentional. I'm just checking to be sure I don't have something
> misconfigured in my environment.
> If I have two scripts or modules in ~/mypyscripts: one script.py and
> one scriptpy (no extension), and do:
> $>pydoc script
> I get the documentation strings for script.py.
> However, if I do:
> $>pydoc scriptpy
> I get no doc strings, even if I am in the ~/mypyscripts directory, error
> "no Python documentation found for 'scriptpy'"
> Instead I must do:
> $>pydoc ~/mypyscripts/scriptpy
> even though ~/mypyscripts is in both PATH and PYTHONPATH
> Took me awhile to sort this out. Is this the way pydoc is supposed to
>From the pydoc documentation:
The argument to pydoc can be the name of a function,
module, or package, or a dotted reference to a class,
method, or function within a module or module in a
package. If the argument to pydoc looks like a path
(that is, it contains the path separator for your
operating system, such as a slash in Unix), and refers
to an existing Python source file, then documentation
is produced for that file.
Since `script` is a valid module name in your case, referencing
script.py, pydoc uses this file. `scriptpy` is no valid module name and
thus, does not work.
More information about the Python-list