# Hello world invalid syntax

**URL:** <https://discuss.python.org/t/hello-world-invalid-syntax/64664>\
**Category:** Python Help\
**Created:** [September 22, 2024, 12:00am UTC](https://discuss.python.org/t/hello-world-invalid-syntax/64664 "2024-09-22T00:00:26Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yelu](https://avatars.discourse-cdn.com/v4/letter/y/c2a13f/32.png) [@Yelu](https://discuss.python.org/u/Yelu)\
**Post date:** [September 22, 2024, 12:00am UTC](https://discuss.python.org/t/hello-world-invalid-syntax/64664/1 "2024-09-22T00:00:26Z")

</div>

Hello 🙂  
Could anyone explain me please how to fix it.

 ![Screenshot (7)](https://us1.discourse-cdn.com/flex002/uploads/python1/original/3X/3/d/3d43f21a977367a4bd049741ee76bb93fb5828fa.jpeg)  
.

I just watching first video by Corey Schafer and do exactly the same but already error…

I can’t open saved file. When in python terminal or cmd i type: python/Desktop.intro.py i have invalid syntax… I’m sorry for silly question.

Thank you.

---

<div class="post-metadata">

**Author:** ![MRAB](https://avatars.discourse-cdn.com/v4/letter/m/e9c0ed/32.png) [@MRAB](https://discuss.python.org/u/MRAB)\
**Post date:** [September 22, 2024, 12:46am UTC](https://discuss.python.org/t/hello-world-invalid-syntax/64664/2 "2024-09-22T00:46:31Z")

</div>

That command is intended for the Windows command line, but you typed it at the Python prompt.

Incidentally, on Windows it’s recommended that you use the Python Launcher `py`:

```python
py %USERPROFILE%\Desktop\intro.py

```

(`%USERPROFILE%\Desktop` will give you the path to the desktop on Windows.)

---

<div class="post-metadata">

**Author:** ![Yelu](https://avatars.discourse-cdn.com/v4/letter/y/c2a13f/32.png) [@Yelu](https://discuss.python.org/u/Yelu)\
**Post date:** [September 22, 2024, 9:31am UTC](https://discuss.python.org/t/hello-world-invalid-syntax/64664/3 "2024-09-22T09:31:47Z")

</div>

Sorry, it is not working at all…  
Look please in his video, he does absolutely the same as me(i do the same :)) )  
when he types all good, when i, it’s always error ☹

 ![image_2024-09-22_103048401](https://us1.discourse-cdn.com/flex002/uploads/python1/original/3X/b/8/b887829b64cc9d4b2b161b9cd17fa0e3611512d1.jpeg)

---

<div class="post-metadata">

**Author:** ![drmason13](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/drmason13/32/22591_2.png) [@drmason13](https://discuss.python.org/u/drmason13)\
**Post date:** [September 22, 2024, 10:58am UTC](https://discuss.python.org/t/hello-world-invalid-syntax/64664/4 "2024-09-22T10:58:15Z")

</div>

It’s already been mentioned but you have typed `python` _into the python interpreter_ in your first screenshot.

In the video they have typed `python` into a _shell_.

**These are not the same thing.**

You may have not used a shell before, in which case you should look into learning how to do so.

[Git bash/git for windows](https://git-scm.com/downloads) is an easy way to get started, but once you are more confident you might want to look at using the Windows subsystem for Linux ([WSL2](https://learn.microsoft.com/en-us/windows/wsl/about)).

None of this is python specific, this is about becoming computer literate to the level required to be a productive programmer.

---

<div class="post-metadata">

**Author:** ![tunedal](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/tunedal/32/14639_2.png) [@tunedal](https://discuss.python.org/u/tunedal)\
**Post date:** [September 22, 2024, 12:09pm UTC](https://discuss.python.org/t/hello-world-invalid-syntax/64664/5 "2024-09-22T12:09:54Z")

</div>

The commands have to be entered in the right context, as the other posts have mentioned. You can look at the prompt for a hint about what context you’re currently in:

- `>>>` means that you’re in the Python interpreter, so it’s expecting you to enter a Python statement.
- `$` means that you’re at the bash shell prompt, so it’s expecting you to enter a Linux command.
- `#` would mean the same when you’re logged in as root (i.e. with admin privileges).
- `C:\>` (or similar) would mean you’re at the Windows command prompt, so it’s expecting a DOS/Windows command.

In the screenshot from the video, you can see that he

1. starts off at the `$` prompt and executes a Linux command to start Python,
2. then enters some Python code at the `>>>` prompt and exits with `exit()`,
3. then, back at the `$` prompt, executes Linux commands again to launch Python with the file `Desktop/intro.py`.

That said, if you just want to run your program from IDLE, you can select “Run module” from the “Run” menu in your editor window (or press F5).
