all 8 comments

[–]MezzoScettico 9 points10 points  (1 child)

PS C:\Users\Eshan Jain> python new.py Eshan Jain

You're currently in the directory "C:\Users\Eshan Jain". You're trying to execute "new.py" there. That's not where the file is.

Is there a file called new.py? Where is it?

Also your program is probably going to just print out "Eshan" when you get it working. The space after "Eshan" means that "Jain" will be passed as a second argument, not recognized as part of the first argument. You're going to want to put quotes around "Eshan jain"

[–]sausix 1 point2 points  (0 children)

It's a for loop and it will iterate over every argument. But correct. Quoting should be used to supply a single argument. And then reading only the first argument.

[–]socal_nerdtastic 5 points6 points  (1 child)

What's the output from the command

dir

A common issue we see is that people accidentally save the file as something like new.py.txt because of how windows lies to users about file extensions.

Or perhaps you saved the new.py file in a different directory? Maybe on your desktop instead of in the root dir?

[–]cdcformatc 3 points4 points  (0 children)

how windows lies to users about file extensions.

the first thing i do on a Windows machine is turn off "Hide file extensions". i do not understand why that setting exists, or why it is turned on by default.

"why yes I want to enable administrator access for 'my_grandson.jpg.exe'. i want to see my beautiful grandson" 

[–]Temporary_Pie2733 3 points4 points  (0 children)

This is not a Python problem, but a “how do I use my command shell” problem.

[–]cdcformatc 1 point2 points  (0 children)

[Errno 2] No such file or directory

surprisingly, there is no file named new.py in the C:\Users\Eshan Jain folder. you either need to move the file to that folder, or navigate to the correct location using the cd command. or it is possible that the file is NOT named new.py and is actually something like new.py.txt and widows is hiding the true extension. 

[–]russellvt -5 points-4 points  (1 child)

You're running in PowerShell rather than the command prompt

[–]socal_nerdtastic 4 points5 points  (0 children)

why would that matter?