How to start IDLE using $ from the command prompt?


Microsoft Windows [Version 10.0.22621.521]
(c) Microsoft Corporation. All rights reserved.

C:\Users\Administrator>cd C:\Users\Administrator\AppData\Local\Programs\Python\Python310

C:\Users\Administrator\AppData\Local\Programs\Python\Python310> python --version
Python 3.10.7

C:\Users\Administrator\AppData\Local\Programs\Python\Python310> $ python
'$' is not recognized as an internal or external command,
operable program or batch file.

C:\Users\Administrator\AppData\Local\Programs\Python\Python310>

The book (Python Programming for Beginners, 2022 by Andrew Park) I’m using to self-teach myself Python claims that to start the IDLE from command prompt, the only thing I need to type is “$ python”. However, even without the correct pathing to the python folder, I still receive the following error.

'$' is not recognized as an internal or external command,
operable program or batch file.

(Yes, using a .py extension from the command prompt does activate the IDLE, I’m trying to figure out how to code as the writer of the book does, so that the book’s example code will work when I try to run it.)

The dollar sign $ is meant to represent the command line prompt. Unfortunately that prompt can vary from computer to computer, for example on yours the prompt is

C:\Users\Administrator>

On my computer it is:

[steve ~]$

Typically, the prompt is one of $ % # > sometimes with leading text as above.

Whatever the prompt is, you don’t type it, only what follows after the prompt.

1 Like

On Windows, we advise leaving the Install py launcher box checked. Then start python with py and any arguments. If you have multiple python.org binaries installed, add a py command argument to select.

Didn’t know that $ meant the command line prompt! is there a known vocab list for Python prompts which I can bookmark for further reference?

$ is the default unix prompt.

Frequently used when documenting how to use command line tools on unix (linux),

I also tend to assume that the example may not work on windows in these cases.

It’s not a Python thing, it’s something your computer does. $ is the most common prompt on a Unix system (or a prompt ending in that, or in # if you are the administrator). On the usual Windows console you get a prompt ending in > .

Examples in books usually show the prompt because that’s what the author gets when they copy from their screen, but also because the reader can then see which parts are to be typed, and which are output from the program as it runs.

When you get Python/Idle working you will see >>> as the prompt, or ... when it thinks you are part-way through typing something and needs more from you before it does anything.

Many examples in the Python docs have a clever button (top right in each green box) that shows you the example without the prompts, to make it easy to copy.

Oh, now I get it! It’s a matter of the book’s author using a Unix System, while I’m using a Windows system. In addition to me not recognizing the $ symbol for what it was supposed to mean… but it’s all cleared up now!

Sometimes books will use a distinct font for the stuff you type versus
the rest (output, prompts, etc).

Cheers,
Cameron Simpson cs@cskk.id.au