FAQ
Hello All,
I'm currently attempting to work my way through Zed Shaw's "Learn Python the
Hard Way" (suggested by co-workers) and have come across an instruction to:
1. In Terminal where you normally run python to run your scripts, type: pydoc
raw_input. Read what it
says.

So in a terminal, at the command prompt I type: pydoc raw_input.
I'm going out on a limb here - I don't believe the following is what I was
supposed to read:
'pydoc' is not recognized as an internal or external command, operable program
or batch file.
The word pydoc is in single quotes.

So, I go back to the terminal and type: python
Then I type: pydoc raw_input
The computer spits back:
File "<stdin>", line1
pydoc raw_input
SyntaxError: invalid syntax
(There is a carrot symbol under the "t" of input.)

What I've done so far to figure it out:
1. Searching Google and here on the tutor mailing list.
I cannot find this exact same phrase - there are many similar ones on the two
pages of returned search results, but not the exact same phrase. I assume from
the verbiage that I don't have "something" installed or I have installed
"something" incorrectly but what exactly I cannot tell.
2. Searching this page: http://docs.python.org/library/pydoc.html
This page contains lots of great information if you already know what you are
doing but not information for how to start or troubleshoot "pydoc." For one as
new as myself this might as well be in a dead language that has no Rosetta
Stone.
3. Picked the brains of the co-workers who recommended the book - they are as
confused as me as to why it's not working. They don't seem to have needed it.

Any suggestions?
Thank you,
R.




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20101112/0ce2438d/attachment-0001.html>

Search Discussions

  • David Hutto at Nov 12, 2010 at 8:20 pm

    For what you're looking for you could use:
    help(raw_input)
    In the python terminal,meaning type python first.

    For pydoc on ubuntu in the command line,

    pydoc -p 1234

    and then take your
    browser to http://localhost:1234, you might need
    to select the work offline mode.

    On windows IIRC it's about the same. I can check
    if you need it.
  • Steven D'Aprano at Nov 12, 2010 at 11:44 pm

    R Johnson wrote:
    'pydoc' is not recognized as an internal or external command, operable program
    or batch file.
    This means that the program "pydoc" is not installed on your computer,
    or is installed somewhere where the operating system (I'm guessing
    you're using Windows?) can't find it.

    Use the Find File command, and see if you can find something called
    "pydoc". You may need to call the full path to the program, e.g.:

    C:\My Documents\path\to\program\pydoc raw_input

    or you may need to install it :)
    So, I go back to the terminal and type: python
    Then I type: pydoc raw_input
    The computer spits back:
    File "<stdin>", line1
    pydoc raw_input
    SyntaxError: invalid syntax
    (There is a carrot symbol under the "t" of input.)
    pydoc is an external tool made with Python, it is not a Python command
    you can run. However, Python does come with an internal tool that is
    nearly as powerful: help().

    From the Python prompt, type:

    help(raw_input)

    and Enter, and you will get something very close to what pydoc would
    have given you.



    --
    Steven
  • Jerry Hill at Nov 12, 2010 at 11:56 pm

    On Fri, Nov 12, 2010 at 6:44 PM, Steven D'Aprano wrote:
    Use the Find File command, and see if you can find something called "pydoc".
    You may need to call the full path to the program, e.g.:

    C:\My Documents\path\to\program\pydoc raw_input
    On my windows PC, it's c:\Python31\Lib\pydoc.py

    So, to do what the tutorial is suggesting, you would need to open a
    command prompt (cmd.exe) and run:
    c:\Python31\Lib\pydoc.py raw_input

    Note: Since I have python 3.1 installed, that wouldn't actually work,
    because python 3.1 no longer has a raw_input function -- it's been
    renamed to just input.

    If you want to be able to run pydoc.py without specifying the full
    path every time, I could add C:\Python31\Lib to my PATH environment
    variable.

    --
    Jerry
  • R Johnson at Nov 13, 2010 at 3:11 am
    Thank you to all who have responded.
    I have a bit of an update that reflects some of these suggestions. I was able to
    snag some time from one of the more experienced engineers and here is what we
    found:

    On my system (Windows 7) the path to the lib file is C:\Python26\lib and
    "pydoc.py" is in this folder. So, he had me run:

    python -m pydoc raw_input
    at that prompt. Sure enough, this returned what looked like help information for
    raw_input.

    And, when we he had me follow the trail: Start > Control Panel > System >
    Advanced Settings > Environment Variables Python26 was in the PATH.





    ________________________________
    From: Steven D'Aprano <steve at pearwood.info>
    To: tutor at python.org
    Sent: Fri, November 12, 2010 5:44:41 PM
    Subject: Re: [Tutor] 'pydoc' is not recognized as an internal or external
    command, ...

    R Johnson wrote:
    'pydoc' is not recognized as an internal or external command, operable program
    or batch file.
    This means that the program "pydoc" is not installed on your computer, or is
    installed somewhere where the operating system (I'm guessing you're using
    Windows?) can't find it.

    Use the Find File command, and see if you can find something called "pydoc". You
    may need to call the full path to the program, e.g.:

    C:\My Documents\path\to\program\pydoc raw_input

    or you may need to install it :)
    So, I go back to the terminal and type: python
    Then I type: pydoc raw_input
    The computer spits back: File "<stdin>", line1
    pydoc raw_input
    SyntaxError: invalid syntax
    (There is a carrot symbol under the "t" of input.)
    pydoc is an external tool made with Python, it is not a Python command you can
    run. However, Python does come with an internal tool that is nearly as powerful:
    help().
    From the Python prompt, type:
    help(raw_input)

    and Enter, and you will get something very close to what pydoc would have given
    you.



    -- Steven
    _______________________________________________
    Tutor maillist - Tutor at python.org
    To unsubscribe or change subscription options:
    http://mail.python.org/mailman/listinfo/tutor




    -------------- next part --------------
    An HTML attachment was scrubbed...
    URL: <http://mail.python.org/pipermail/tutor/attachments/20101112/4add4265/attachment-0001.html>

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouptutor @
categoriespython
postedNov 12, '10 at 7:58p
activeNov 13, '10 at 3:11a
posts5
users4
websitepython.org

People

Translate

site design / logo © 2023 Grokbase