Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > pydoc script.py vs. pydoc scriptpy

Reply
Thread Tools

pydoc script.py vs. pydoc scriptpy

 
 
BartlebyScrivener
Guest
Posts: n/a
 
      10-20-2007
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 message:
"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
work?

thanks,

rpd

 
Reply With Quote
 
 
 
 
Stargaming
Guest
Posts: n/a
 
      10-22-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
> message:
> "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
> work?
>
> thanks,
>
> rpd


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.

HTH,
Stargaming
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
PyDoc Private Functions Paradox Python 0 12-05-2003 02:59 PM
Documentation using PyDoc Colin J. Williams Python 1 10-23-2003 07:00 PM
How does pydoc parse code? Greg Kuperberg Python 2 10-17-2003 11:14 PM
Re: Securing PyDoc and CGIHTTPserver Peter Hansen Python 7 07-15-2003 01:03 PM
Re: Securing PyDoc and CGIHTTPserver Shane Hathaway Python 1 07-11-2003 05:05 PM



Advertisments