Python Forum
'Hello, World!' Problem - Urgent
Thread Rating:
  • 1 Vote(s) - 1 Average
  • 1
  • 2
  • 3
  • 4
  • 5
'Hello, World!' Problem - Urgent
#1
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
Reply
#2
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.
Reply
#3
[Image: O65IH]

Still not working
Reply
#4
If you change the extension to .pyw, you can double click on it and it will run.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply
#5
(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.
Reply
#6
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.
If it ain't broke, I just haven't gotten to it yet.
OS: Windows 10, openSuse 42.3, freeBSD 11, Raspian "Stretch"
Python 3.6.5, IDE: PyCharm 2018 Community Edition
Reply
#7
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.
Reply
#8
(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
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Hello World! rufenghk 0 933 Jun-02-2022, 09:48 PM
Last Post: rufenghk
  Very new to Python world daveseaman 0 1,452 Jun-25-2021, 07:17 PM
Last Post: daveseaman
  Need urgent help OneTwo 9 2,800 Nov-24-2020, 08:40 AM
Last Post: OneTwo
  Need help urgent fireablade 1 1,462 Oct-01-2019, 05:30 PM
Last Post: buran
  Help | Classes to use in real world soothsayerpg 9 4,058 Jul-08-2019, 07:30 PM
Last Post: nilamo
  running python hello world Avarage_Joe 8 5,203 Apr-13-2018, 04:20 PM
Last Post: Avarage_Joe
  Hello world! program, window disappears nerio 3 5,567 Mar-16-2018, 07:03 PM
Last Post: knackwurstbagel
  how to generate random 3d world (like minecraft) in python hsunteik 3 88,822 Jan-06-2017, 06:35 PM
Last Post: metulburr
  Hello World issues when using %% with ipython landlord1984 5 8,775 Dec-11-2016, 10:11 PM
Last Post: Yoriz

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020