views:

161

answers:

3

Using Windows XP and Python 2.7 I tried to run "pydoc" through the terminal. unfortunately it doesn't work.

Since I'm not allowed to post a screenshot (Newbie). Here is what it says (white on black)

"C:\Python27>pydoc raw_input /"pydoc raw_input" is what I typed Der Befehl "pydoc" ist entweder falsch geschrieben oder konnte nicht gefunden werden. /This shows up after I hit enter. It's German an it roughly translates to"The command "pydoc" is either spelled wrong or couldn't be found.

What am I doing wrong.

By the way, I just started to teach myself programming using Zed Shaws "Learn Python the Hard Way" and this is the first issue I really can't figure out using Google. I start to believe that it is Windows an not me... (beeing to broke to afford a Mac and to scared to learn Linux).

+2  A: 

pydoc is actually a Python script (so, on Windows, you need to look for pydoc.py), and it's not added to the Windows %PATH% by default (so you need to give a full pathname).

Try running c:\Python27\Lib\pydoc.py from your command line.

Edit: For a graphical interface to Python's documentation, you might want to instead run c:\Python27\Tools\Scripts\pydocgui.pyw (from the command line or from Windows Explorer). This starts pydoc's web server on your local PC so you can access the documentation through your web browser.

Josh Kelley
Thanks so much! Now I'm really glad that this problem made me try out Stack Overflow.
Twiek
If you don't know the installation path, you can run pydoc using the command `python -m pydoc ...`.
Cristian Ciupitu
This did not really answer Twiek's question. He wanted to know how to run 'pydoc' command from the command line. all the answers above are work arounds. The answer can be found at Dave Webb's answer below but he did not say where to place the pydoc.bat file he spoke of. My comments help clear that up. Happy to say pydoc now works for me on windows.
J3M 7OR3
A: 

The simplest way to do this would be to change to the Python27/Lib directory and run the command from there, like so:

C:\Documents and Settings\username>cd C:\Python27\Lib

C:\Python27\Lib>python pydoc.py raw_input
Help on built-in function raw_input in module __builtin__:
Ryan Mentley
+1  A: 

There's no pydoc command in Windows. You'll need to specify the full path to pydoc.py. For example to start the pydoc GUI use:

python c:\Python26\lib\pydoc.py -g

If you want to add the pydoc command, create a pydoc.bat file with the following line in it:

@python c:\Python26\lib\pydoc.py %*
Dave Webb
@Dave Webb where should one place the pydoc.bat file?
J3M 7OR3
@Dave Webb oh never mind. I figured out that it had to be placed in the Scripts folder which for me is C:\python27\Tools\Scripts. Thanks :)
J3M 7OR3