0

I have downloaded Atom.io for window and done setup successfully, then I download the package for running codes. but the Python result always come with an error like the picture.

Can you help me on this issue? Thank you

enter image description here

RoadieRich
  • 6,330
  • 3
  • 35
  • 52

3 Answers3

1

Try typing in:

python myprogram.py

However, you will still receive an invalid syntax error because:

print(*hi*) 

should be:

print('hi') 

Also, if you want to enter the python terminal, type:

python

Then you can type these commands (i.e. print("hi")) directly into the terminal instead of creating a .py file and running it.

One final point, I use the following instructions to add the python to PATH: how to add python to path in windows.

  • After I typed the code , the result still comes out an error of " The term Python is not recognized as the name of a cmdlet,...". Do you think I have to change something in the path more properly ? This is the 1st time i tried this coding platform that might cause a bit confuse :( – Tri Nguyen Mar 19 '19 at 23:56
  • @Tri - you may not have Python set up in PATH correctly. What version of Python are you using? The directory in your screenshot is Version 2.7, if you just downloaded Python, you probably have Version 3.7. The folder you want to direct PATH to is the folder where python.exe is located. For example, on my PC this is C:/Programs/Python37. Then use these instructions but replace the directory: https://stackoverflow.com/questions/3701646/how-to-add-to-the-pythonpath-in-windows – drumstick2121 Mar 20 '19 at 13:29
0

It looks like you're running this from powershell. You can tell it's powershell because it says "Windows Powershell" on the first line of the output. Here's what I would do if I were you:

  1. To start the python shell type python and press enter.

1a. Enter what you want to run in python, print('test') for example

  1. If you want to get out of the python shell, enter ctrl-z and press enter to return to powershell.
  2. To run python scripts use the command python {script}.py

Installing python on path

If you tried the above steps and got an error to the effect of "I don't recognize python" you should ensure that python is correctly installed in your PATH.

You can follow these instructions to install python correctly.

milespossing
  • 130
  • 6
  • After I typed the code , the result still comes out an error of " The term Python is not recognized as the name of a cmdlet,...". Do you think I have to change something in the path more properly ? – Tri Nguyen Mar 19 '19 at 23:59
  • @TriNguyen I've just edited my answer to include a link to how to add python to the PATH – milespossing Mar 20 '19 at 14:17
0

You can check this Stack Overflow thread for more details.

However, if you just want to play around with Python in Windows:

  1. Download Python and install it.
  2. Go to Start > type "IDLE" and click "IDLE (Python)".
  3. Start coding! For example, type print("Hello, world!") and press the Enter key.

My first contact with Python was IDLE and I liked it a lot. Have fun!

marw
  • 2,939
  • 4
  • 28
  • 37
  • I could not find the item "IDLE" in Start, bro ! I tried to search for the file in both \C: drive but nothing comes out – Tri Nguyen Mar 19 '19 at 23:59
  • @TriNguyen, if you installed Python (the step 1), and still can't find IDLE, run it from `C:\Users\your_username\AppData\Local\Programs\Python\Python36-32\Lib\idlelib`. Double-click `idle.py`. At least that is what I see on my Windows 10 machine. – marw Mar 20 '19 at 11:53