Python Forum

Full Version: [Error 2] running from cmd win 10 fresh install
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi there and thank you for looking. I am very much a novice and believe Python would be an ideal language to start with due to the simplicity of the syntax. Unfortunately I have hit a road block right away.


I am using a tutorial that is a few years old that used python 3.5.1 I installed 3.6.0 as from what I could see there should be no major issues. I downloaded the x86-64 installer from the official Python website and when installing made sure to have that PATHING is selected and left the location as default (this is in appdata and not c:\(LOCATION) like all tutorials suggest). The tutorial asks me to make a text doc and type:
print(“Hello World”)
then save the text doc (filename=hello)with .py as the end of the file name. Then run cmd console type
python
this returns the version etc
I exit that and now am to run the hello.py the folder location is (I have tried Desktop and other locations all seem to fail) on C:\PythonPractice (I removed the space in an attempt to solve the problem, no luck)
I do this by either cd.. to reach c and then cd pythonpractice to enter the folder.
Then type
py hello.py
and it returns
c:\”PATH”\python.exe: can't open file “hello.py”: [Error 2] No such file or directory


I have tried uninstalling and reinstalling, changed the location of python from Appdata to c:\ and looked online and found nobody else who has had this issue yet alone a solution. I am at a complete loss and I worry that if the basics are so difficult then maybe this is not a suitable language for learning like I thought?


Would very much appreciate a solution to this and thank you very much for reading.
I really wish Python would make the default location "C:\Python36" it would make life so much simpler. 

Any who,  a couple of things.  When you save a file, such as your "hello.py", it will be saved in your current directory (unless you specifically tell it different), so if you are in "C:\ " that is where it will be saved. If you are currently in "C:\PythonPractice" that is where it will be saved.  If you can't remember where it was saved, use the File Manager and search for "hello.py" (no doubt there will only be one listing :-) ). Now you have a choice, run it from it's current location or move it to your PythonPractice folder.  In either case, once you open your cmd window, you need to change to that directory, for example, from the command line, type:
cd c:\pythonpractice    # note that Windows is not case sensative but the *nix's are
Now that you are in the correct folder, simply type "hello.py" (w/o quotes).

In short, do not use "py hello.py", just "hello.py"
Follow my advice in this post.
Quote:I really wish Python would make the default location "C:\Python36" it would make life so much simpler. 
Yeah that was a dumb decision on their part. What makes it even worse is by default windows doesnt allow a user to view the appdata directory. So that adds one more damn step to the process.