Python Forum
'Hello, World!' Problem - Urgent - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: 'Hello, World!' Problem - Urgent (/thread-4753.html)



'Hello, World!' Problem - Urgent - OmarSinno - Sep-06-2017

Hello, I'm new to programming and you probably already realized that I'm a noob after reading the title of this thread.
Anyway, I use the atom editor, and as interpreter I want to use PowerShell.
I have changed the directory path to where my hello.py file is located, and yet when I write 'python 3 hello.py' 'hello.py' or even 'python3' it either says the file doesnt exist, or forces me to open the python cmd instead of actually running the program!

[Image: PhtdV5F.png]

Thank you in advance!
Big Grin


RE: 'Hello, World!' Problem - Urgent - cygnus_X1 - Sep-06-2017

As youre running under windows the command will probably be:

python3.exe hello.py

I cant verify this as I'm running linux.

The answer is in the python doc:

https://docs.python.org/3.3/using/windows.html

You need to install the python installer for windows.


RE: 'Hello, World!' Problem - Urgent - OmarSinno - Sep-06-2017

[Image: O65IH]

Still not working


RE: 'Hello, World!' Problem - Urgent - ichabod801 - Sep-06-2017

If you change the extension to .pyw, you can double click on it and it will run.


RE: 'Hello, World!' Problem - Urgent - OmarSinno - Sep-06-2017

(Sep-06-2017, 08:52 PM)ichabod801 Wrote: If you change the extension to .pyw, you can double click on it and it will run.

Same shit, different extension lol.


RE: 'Hello, World!' Problem - Urgent - sparkz_alot - Sep-06-2017

Presuming you have installed Python correctly, you should know that Python uses the command terminal by default, not PowerShell. If you file is something like:
print("hello world")
When you type "hello.py" in PowerShell, Python will open a command terminal window, print "hello world" then close the window. This happens faster than the human eye can register, so you should run it from a command terminal rather than PowerShell.

As to the problem you refer to, sounds as if the Environmental Variables may not be set. You can verify this by typing in a command terminal (not PowerShell) C:\> PATH , you should see the following entries:

Output:
C:\>PATH PATH=C:\Python36\Scripts\;C:\Python36\;
If they do not exist, you have to add them. If they do exist, try typing "python" (in either command terminal or PowerShell), you should see similar:
Output:
C:\>python Python 3.6.2 (v3.6.2:5fd33b5, Jul  8 2017, 04:57:36) [MSC v.1900 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>>
If you still have a problem, please post the directory where you installed Python. Verify that the location were you saved your file is indeed where it is installed.

Also, please do not post screen images, rather copy and paste any code, output and errors between their respective tags. Refer to our Help / Rules document on BBCode for instructions.


RE: 'Hello, World!' Problem - Urgent - snippsat - Sep-06-2017

You could also look at this Python 3.6 and pip installation under Windows.
It's important to know that for new installer 3.6 there is a Add Python 3.6 to Path .

If not Add to Path is marked,you have to deal with it yourself as @sparkz_alot posted.
C:\Python36\Scripts\;C:\Python36\; to Environmental Variables Path.


RE: 'Hello, World!' Problem - Urgent - OmarSinno - Sep-07-2017

(Sep-06-2017, 10:23 PM)snippsat Wrote: You could also look at this Python 3.6 and pip installation under Windows.
It's important to know that for new installer 3.6 there is a Add Python 3.6 to Path .

If not Add to Path is marked,you have to deal with it yourself as @sparkz_alot posted.
C:\Python36\Scripts\;C:\Python36\; to Environmental Variables Path.

Thank you I just tested it in the lab and it worked.
I will go home now and repeat all the work I've done! Dance